summaryrefslogtreecommitdiff
path: root/src/bin/exactness/player.c
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2020-02-25 11:20:21 +0100
committerStefan Schmidt <s.schmidt@samsung.com>2020-02-26 15:15:43 +0100
commitfa0fd8214f9db72413738686b81bb8a0576528c2 (patch)
treef4888bdef43a152917fa075b2cec520cc7f85c7e /src/bin/exactness/player.c
parent070333c8cc72effb209d9023e3ace681e35dced5 (diff)
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
Diffstat (limited to '')
-rw-r--r--src/bin/exactness/player.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bin/exactness/player.c b/src/bin/exactness/player.c
index 13de9bffe3..048232e537 100644
--- a/src/bin/exactness/player.c
+++ b/src/bin/exactness/player.c
@@ -1004,8 +1004,9 @@ _old_shots_rm_cb(const char *name, const char *path, void *data)
1004 unsigned int len = strlen(prefix); 1004 unsigned int len = strlen(prefix);
1005 if (!strncmp(name, prefix, len) && (strlen(name) > len) && (name[len] == SHOT_DELIMITER)) 1005 if (!strncmp(name, prefix, len) && (strlen(name) > len) && (name[len] == SHOT_DELIMITER))
1006 { 1006 {
1007 char *buf = alloca(strlen(path) + strlen(name)); 1007 unsigned int length = strlen(path) + strlen(name) + 2;
1008 sprintf(buf, "%s/%s", path, name); 1008 char *buf = alloca(length);
1009 snprintf(buf, length, "%s/%s", path, name);
1009 if (unlink(buf)) 1010 if (unlink(buf))
1010 { 1011 {
1011 printf("Failed deleting '%s/%s': ", path, name); 1012 printf("Failed deleting '%s/%s': ", path, name);