From: Stefan Schmidt Date: Tue, 25 Feb 2020 10:20:21 +0000 (+0100) Subject: exactness: player: allow space for the terminating null X-Git-Tag: submit/tizen/20200303.214157~56 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff1005ce8bd66a3c3c01cafbe002231d446f90e2;p=platform%2Fupstream%2Fefl.git 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 Differential Revision: https://phab.enlightenment.org/D11410 --- 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) 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);