From: Jaroslav Kysela Date: Fri, 3 Oct 2014 15:31:29 +0000 (+0200) Subject: filebundle: fix possible buf overflow in fb_scandir() - coverity X-Git-Tag: v4.1~1169 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60aeeac40d128b30fe417d4359006ce80e04af6e;p=thirdparty%2Ftvheadend.git filebundle: fix possible buf overflow in fb_scandir() - coverity --- diff --git a/src/filebundle.c b/src/filebundle.c index 49e876c36..df8d93bc5 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++; }