Skip to contentSkip to conversation

qemu/block-vvfat.c: fix warnings with _FORTIFY_SOURCE

PATCH In review Olaf Hering 2 participants 4 messages Nov 2, 2010 – Nov 3, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu/block-vvfat.c: fix warnings with _FORTIFY_SOURCE

In function 'snprintf',
inlined from 'init_directories' at block-vvfat.c:868:10,
inlined from 'vvfat_open' at block-vvfat.c:1065:24:
/usr/include/bits/stdio2.h:65:3: warning: call to __builtin___snprintf_chk will always overflow destination buffer

---
 ioemu-remote/block-vvfat.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
ioemu-remote/block-vvfat.c +2 -1
@@ -865,7 +865,8 @@ static int init_directories(BDRVVVFATSta
     {
 	direntry_t* entry=array_get_next(&(s->directory));
 	entry->attributes=0x28; /* archive | volume label */
-	snprintf((char*)entry->name,11,"QEMU VVFAT");
+	memcpy(entry->name,"QEMU VVF",8);
+	memcpy(entry->extension,"AT",3);
     }
 
     /* Now build FAT, and write back information into directory */
#1 lore raw

Olaf Hering writes ("[Xen-devel] [PATCH] qemu/block-vvfat.c: fix warnings with _FORTIFY_SOURCE"):

Quoted 4 lines

In function 'snprintf',
inlined from 'init_directories' at block-vvfat.c:868:10,
inlined from 'vvfat_open' at block-vvfat.c:1065:24:
/usr/include/bits/stdio2.h:65:3: warning: call to __builtin___snprintf_chk will always overflow destination buffer

Thanks, I have applied both of these patches to qemu-xen-unstable.

However: have you checked whether these problems exist in qemu upstream ? With Anthony's work on upstreaming Xen support in qemu coming along well, we should be thinking about sending fixes like this upstream.

When we switch to the upstream-based qemu we won't want to carry a lot of patches like this one.

Regards,
Ian.

#2 lore raw
Quoted 4 lines · Ian Jackson

However: have you checked whether these problems exist in qemu upstream ? With Anthony's work on upstreaming Xen support in qemu coming along well, we should be thinking about sending fixes like this upstream.

The vvfat patch is already upstream, the other one should be there too. But I havent verified it, the website does not resolve for me right now.

Olaf

#3 lore raw

Olaf Hering writes ("Re: [Xen-devel] [PATCH] qemu/block-vvfat.c: fix warnings with _FORTIFY_SOURCE"):

Quoted 8 lines · Ian Jackson
Quoted 4 lines

However: have you checked whether these problems exist in qemu upstream ? With Anthony's work on upstreaming Xen support in qemu coming along well, we should be thinking about sending fixes like this upstream.

The vvfat patch is already upstream, the other one should be there too. But I havent verified it, the website does not resolve for me right now.

Great, thanks. I guess in this case if it gets dropped the compiler will tell us in due course.

Ian.