summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-01-05 13:39:53 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-01-05 13:39:53 +0100
commit766ba710662c015d9c9d3c161c31c01fb28b30a2 (patch)
treec3528e0f0c91f1d4c5c422ed9d02ce436e2f8437
parentccd26d2017c7c9a83ef7d586ae039008c23ddcec (diff)
sfeed_frames: check truncation for path
-rw-r--r--sfeed_frames.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sfeed_frames.c b/sfeed_frames.c
index 5d40d07..e25ad28 100644
--- a/sfeed_frames.c
+++ b/sfeed_frames.c
@@ -181,8 +181,9 @@ main(int argc, char *argv[])
/* directory doesn't exist: try to create it. */
if(stat(dirpath, &st) == -1 && mkdir(dirpath, S_IRWXU) == -1)
- xerr(1, "sfeed_frames: can't make directory '%s'", dirpath);
- strlcpy(reldirpath, name, sizeof(reldirpath)); /* TODO: check truncation */
+ xerr(1, "can't make directory '%s'", dirpath);
+ if(strlcpy(reldirpath, name, sizeof(reldirpath)) >= sizeof(reldirpath))
+ xerr(1, "strlcpy: truncation");
if(!(f = calloc(1, sizeof(struct feed))))
xerr(1, "calloc");