mirror of
https://github.com/bradgrantham/apple2e.git
synced 2024-06-08 02:29:26 +00:00
fix #25, terminate the pasted string with NUL
Allocate one more byte, and append a '\0'. Whoops.
This commit is contained in:
parent
72134f94dd
commit
a9aefa583a
|
@ -1126,8 +1126,9 @@ struct apple2screen : public widget
|
|||
fseek(fp, 0, SEEK_END);
|
||||
long length = ftell(fp);
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
char *text = (char *)malloc(length);
|
||||
char *text = (char *)malloc(length + 1);
|
||||
fread(text, 1, length, fp);
|
||||
text[length] = '\0';
|
||||
event_queue.push_back({PASTE, 0, text});
|
||||
fclose(fp);
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue
Block a user