From 60aeeac40d128b30fe417d4359006ce80e04af6e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 3 Oct 2014 17:31:29 +0200 Subject: [PATCH] filebundle: fix possible buf overflow in fb_scandir() - coverity --- src/filebundle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/filebundle.c b/src/filebundle.c index 49e876c3..df8d93bc 100644 --- a/src/filebundle.c +++ b/src/filebundle.c @@ -349,7 +349,8 @@ int fb_scandir ( const char *path, fb_dirent ***list ) i = 0; while (fb) { (*list)[i] = calloc(1, sizeof(fb_dirent)); - strcpy((*list)[i]->name, fb->name); + strncpy((*list)[i]->name, fb->name, sizeof((*list)[i]->name)); + (*list)[i]->name[sizeof((*list)[i]->name)-1] = '\0'; fb = fb->next; i++; }