aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--noice.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/noice.c b/noice.c
index 656ec8f..eed9189 100644
--- a/noice.c
+++ b/noice.c
@@ -347,6 +347,7 @@ nochange:
}
if (ret == 3) {
char *pathnew, *pathtmp;
+ size_t pathsiz;
char *name;
u_int8_t type;
char *bin;
@@ -360,9 +361,9 @@ nochange:
name = dents[cur]->d_name;
type = dents[cur]->d_type;
- pathnew = malloc(strlen(path) + 1
- + strlen(name) + 1);
- sprintf(pathnew, "%s/%s", path, name);
+ pathsiz = strlen(path) + 1 + strlen(name) + 1;
+ pathnew = malloc(pathsiz);
+ snprintf(pathnew, pathsiz, "%s/%s", path, name);
DPRINTF_S(name);
DPRINTF_U(type);