aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/misc.c b/src/misc.c
index 5803279..91eab11 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -415,7 +415,7 @@ void Insert_Only_Digit (GtkEditable *editable, const gchar *inserted_text, gint
}
g_signal_stop_emission_by_name(G_OBJECT(editable),"insert_text");
- result = g_malloc0(length);
+ result = g_malloc0(length+1);
result[0] = inserted_text[0];
// Check the rest, if any...
@@ -426,6 +426,8 @@ void Insert_Only_Digit (GtkEditable *editable, const gchar *inserted_text, gint
result[j++] = inserted_text[i];
}
}
+ // Null terminate for the benefit of glib/gtk
+ result[j] = '\0';
if (result[0] == (gchar)NULL)
{