From 766ba710662c015d9c9d3c161c31c01fb28b30a2 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Mon, 5 Jan 2015 13:39:53 +0100 Subject: sfeed_frames: check truncation for path --- sfeed_frames.c | 5 +++-- 1 file 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"); -- cgit v1.2.3