projects
/
platform
/
upstream
/
efl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e902559
)
exactness: player: allow space for the terminating null
author
Stefan Schmidt
<s.schmidt@samsung.com>
Tue, 25 Feb 2020 10:20:21 +0000
(11:20 +0100)
committer
Jongmin Lee
<jm105.lee@samsung.com>
Tue, 3 Mar 2020 21:15:14 +0000
(06:15 +0900)
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
src/bin/exactness/player.c
patch
|
blob
|
history
diff --git
a/src/bin/exactness/player.c
b/src/bin/exactness/player.c
index 13de9bffe37c833d16fda973d38ddf19c2d02cf4..048232e53799a86221bfcfa20bcbb13d9f248938 100644
(file)
--- 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);