]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
filebundle: fix possible buf overflow in fb_scandir() - coverity
authorJaroslav Kysela <perex@perex.cz>
Fri, 3 Oct 2014 15:31:29 +0000 (17:31 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 3 Oct 2014 15:31:29 +0000 (17:31 +0200)
src/filebundle.c

index 49e876c3659a207fe470d404a47bcc6fcbbe7fa7..df8d93bc565ac4e89d4f58ce983f3fab7d61a393 100644 (file)
@@ -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++;
     }