Fix an off-by-one error in buffer allocation

Signed-off-by: Mikko Rasa <tdb@tdb.fi>
This commit is contained in:
Mikko Rasa 2012-08-22 00:26:58 +03:00
parent 0c49d406e0
commit c6be2404da

View file

@ -223,7 +223,7 @@ static gboolean ask_save_changes()
label = gtk_label_new ( label = gtk_label_new (
"You have unsaved changes\nWould you like to save those before exiting the program?"); "You have unsaved changes\nWould you like to save those before exiting the program?");
} else { } else {
char *label_text = (char*) malloc(sizeof(char) * (92 + strlen(existing_filename))); char *label_text = (char*) malloc(sizeof(char) * (93 + strlen(existing_filename)));
sprintf(label_text, sprintf(label_text,
"You have unsaved changes to file: %s \nWould you like to save those before exiting the program?", "You have unsaved changes to file: %s \nWould you like to save those before exiting the program?",
existing_filename); existing_filename);