filebundle: fix possible buf overflow in fb_scandir() - coverity

This commit is contained in:
Jaroslav Kysela 2014-10-03 17:31:29 +02:00
parent a0e4c0133c
commit 60aeeac40d

View 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++;
}