commit 766ba710662c015d9c9d3c161c31c01fb28b30a2
parent ccd26d2017c7c9a83ef7d586ae039008c23ddcec
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Mon,  5 Jan 2015 13:39:53 +0100

sfeed_frames: check truncation for path

Diffstat:
Msfeed_frames.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 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");