Make sure that tmppath is always NULL-terminated
Fixes GitHub issue #5. Reported-by: dcb314 Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
936d5f139f
commit
a32f6b008a
@ -600,8 +600,8 @@ unsigned config_save(void)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
strncpy(tmppath, get_tempdir(), BUFSIZ);
|
strncpy(tmppath, get_tempdir(), BUFSIZ);
|
||||||
strncat(tmppath, "/" CONF_PATH_NAME ".",
|
tmppath[BUFSIZ - 1] = '\0';
|
||||||
BUFSIZ - strlen(tmppath) - 1);
|
strncat(tmppath, "/" CONF_PATH_NAME ".", BUFSIZ - strlen(tmppath) - 1);
|
||||||
if ((tmpext = new_tempfile(tmppath, TMPEXTSIZ)) == NULL)
|
if ((tmpext = new_tempfile(tmppath, TMPEXTSIZ)) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
strncat(tmppath, tmpext, BUFSIZ - strlen(tmppath) - 1);
|
strncat(tmppath, tmpext, BUFSIZ - strlen(tmppath) - 1);
|
||||||
|
@ -83,6 +83,7 @@ void edit_note(char **note, const char *editor)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
strncpy(tmppath, get_tempdir(), BUFSIZ);
|
strncpy(tmppath, get_tempdir(), BUFSIZ);
|
||||||
|
tmppath[BUFSIZ - 1] = '\0';
|
||||||
strncat(tmppath, "/calcurse-note.", BUFSIZ - strlen(tmppath) - 1);
|
strncat(tmppath, "/calcurse-note.", BUFSIZ - strlen(tmppath) - 1);
|
||||||
if ((tmpext = new_tempfile(tmppath, TMPEXTSIZ)) == NULL)
|
if ((tmpext = new_tempfile(tmppath, TMPEXTSIZ)) == NULL)
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user