From 1cb1f674a0553367aa91402b08f19821568bfd46 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 3 Oct 2014 17:03:33 +0200 Subject: [PATCH] filebundle: coverity - fix possible buf overflow in fb_readdir() --- src/filebundle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/filebundle.c b/src/filebundle.c index 4f18e103..49e876c3 100644 --- a/src/filebundle.c +++ b/src/filebundle.c @@ -280,7 +280,8 @@ fb_dirent *fb_readdir ( fb_dir *dir ) fb_dirent *ret = NULL; if (dir->type == FB_BUNDLE) { if (dir->b.cur) { - strcpy(dir->dirent.name, dir->b.cur->name); + strncpy(dir->dirent.name, dir->b.cur->name, sizeof(dir->dirent.name)-1); + dir->dirent.name[sizeof(dir->dirent.name)-1] = '\0'; dir->dirent.type = dir->b.cur->type; dir->b.cur = dir->b.cur->next; ret = &dir->dirent;