exactness: player: allow space for the terminating null
Allocate extra space for the terminating null byte and / of the string. Switch to snprintf() as well. CID: 1419863 Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D11410
This commit is contained in:
parent
070333c8cc
commit
fa0fd8214f
|
@ -1004,8 +1004,9 @@ _old_shots_rm_cb(const char *name, const char *path, void *data)
|
|||
unsigned int len = strlen(prefix);
|
||||
if (!strncmp(name, prefix, len) && (strlen(name) > len) && (name[len] == SHOT_DELIMITER))
|
||||
{
|
||||
char *buf = alloca(strlen(path) + strlen(name));
|
||||
sprintf(buf, "%s/%s", path, name);
|
||||
unsigned int length = strlen(path) + strlen(name) + 2;
|
||||
char *buf = alloca(length);
|
||||
snprintf(buf, length, "%s/%s", path, name);
|
||||
if (unlink(buf))
|
||||
{
|
||||
printf("Failed deleting '%s/%s': ", path, name);
|
||||
|
|
Loading…
Reference in New Issue