diff options
author | Benjamin Close <Benjamin.Close@clearchain.com> | 2008-12-11 15:26:13 +1030 |
---|---|---|
committer | Benjamin Close <Benjamin.Close@clearchain.com> | 2008-12-11 15:26:13 +1030 |
commit | 9ad7f24fafe876851b89190732034da6fb640788 (patch) | |
tree | 8b7e7676a86854085b1a08d1e7d2ea1254af4e12 | |
parent | d93cc906d4a2f42d11629e245fb13a2d08cf2a61 (diff) |
Make sure font names/font alias names are null terminated
This fixes a crash upon server restart where the saved fonts were
being restored however strlen(font_name) was incorrect hence memory
was being clobbered.
-rw-r--r-- | src/builtins/dir.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/builtins/dir.c b/src/builtins/dir.c index 1f7f547..dd2ea1a 100644 --- a/src/builtins/dir.c +++ b/src/builtins/dir.c @@ -45,10 +45,10 @@ BuiltinDirsDup (const BuiltinDirPtr a_dirs, for (i=0; i < a_dirs_len; i++) { int len = strlen (a_dirs[i].file_name) ; - dirs[i].file_name = xcalloc (1, len) ; + dirs[i].file_name = xcalloc (1, len+1) ; memmove (dirs[i].file_name, a_dirs[i].file_name, len); len = strlen (a_dirs[i].font_name) ; - dirs[i].font_name = xcalloc (1, len) ; + dirs[i].font_name = xcalloc (1, len+1) ; memmove (dirs[i].font_name, a_dirs[i].font_name, len); } return dirs ; @@ -110,7 +110,7 @@ BuiltinAliasesDup (const BuiltinAliasPtr a_aliases, for (i=0; i < a_aliases_len; i++) { int len = strlen (a_aliases[i].font_name) ; - aliases[i].font_name = xcalloc (1, len) ; + aliases[i].font_name = xcalloc (1, len+1) ; memmove (aliases[i].font_name, a_aliases[i].font_name, len); } return aliases ; |