summaryrefslogtreecommitdiff
path: root/src/local.c
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2012-09-30 11:36:22 +0200
committerportix <portix@gmx.net>2012-09-30 11:36:22 +0200
commit430499af09b0ba3c44ef87c83b67a834b24ac40c (patch)
treeffb813849417be4eefe5e939485e91b71d910deb /src/local.c
parentc07c1a6a5f76cca0861dad25823e2b61ffd5b941 (diff)
downloaddwb-430499af09b0ba3c44ef87c83b67a834b24ac40c.zip
Use sizeof for stack-allocated strings; fixing one possible buffer overflow
Diffstat (limited to 'src/local.c')
-rw-r--r--src/local.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/local.c b/src/local.c
index 9c91f8b4..64ff7424 100644
--- a/src/local.c
+++ b/src/local.c
@@ -129,16 +129,16 @@ local_show_directory(GList *gl, const char *path, gboolean add_to_history) {
fprintf(stderr, "stat failed for %s\n", fullpath);
continue;
}
- strftime(date, 50, "%x", localtime(&st.st_mtime));
- strftime(time, 50, "%X", localtime(&st.st_mtime));
+ strftime(date, sizeof(date), "%x", localtime(&st.st_mtime));
+ strftime(time, sizeof(time), "%X", localtime(&st.st_mtime));
if (st.st_size > BPGB)
- snprintf(size, 50, "%.1fG", (double)st.st_size / BPGB);
+ snprintf(size, sizeof(size), "%.1fG", (double)st.st_size / BPGB);
else if (st.st_size > BPMB)
- snprintf(size, 50, "%.1fM", (double)st.st_size / BPMB);
+ snprintf(size, sizeof(size), "%.1fM", (double)st.st_size / BPMB);
else if (st.st_size > BPKB)
- snprintf(size, 50, "%.1fK", (double)st.st_size / BPKB);
+ snprintf(size, sizeof(size), "%.1fK", (double)st.st_size / BPKB);
else
- snprintf(size, 50, "%lu", st.st_size);
+ snprintf(size, sizeof(size), "%lu", st.st_size);
char perm[11];
int bits = 0;