1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-28 09:29:07 +00:00

Merge pull request #139 from TomHarte/TyperFixes

Corrects a potential invalid memory dereference in the default typer implementation
This commit is contained in:
Thomas Harte 2017-07-06 21:40:15 -04:00 committed by GitHub
commit 55df96491c
2 changed files with 1 additions and 2 deletions

View File

@ -15,7 +15,7 @@ Typer::Typer(const char *string, int delay, int frequency, Delegate *delegate) :
counter_(-delay), frequency_(frequency), string_pointer_(0), delegate_(delegate), phase_(0) {
size_t string_size = strlen(string) + 3;
string_ = (char *)malloc(string_size);
snprintf(string_, strlen(string) + 3, "%c%s%c", Typer::BeginString, string, Typer::EndString);
snprintf(string_, string_size, "%c%s%c", Typer::BeginString, string, Typer::EndString);
}
void Typer::update(int duration) {

View File

@ -51,7 +51,6 @@ class TypeRecipient: public Typer::Delegate {
void typer_reset(Typer *typer) {
clear_all_keys();
typer_.reset();
}
protected: