Skip to contentSkip to conversation

libxc: Fix gcc 4.3 build failure

PATCH New Kouya Shimura 1 participant 1 message Dec 8, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxc: Fix gcc 4.3 build failure

gcc-4.3.2-1ubuntu11 complains:

xc_dom_x86.c: In function 'start_info_x86_32':
xc_dom_x86.c:421: error: format not a string literal and no format arguments xc_dom_x86.c:421: error: format not a string literal and no format arguments xc_dom_x86.c: In function 'start_info_x86_64':
xc_dom_x86.c:460: error: format not a string literal and no format arguments xc_dom_x86.c:460: error: format not a string literal and no format arguments

tools/libxc/xc_dom_x86.c +4 -2
diff -r cc82d54bedfd tools/libxc/xc_dom_x86.c
@@ -418,7 +418,8 @@ static int start_info_x86_32(struct xc_d
     xc_dom_printf("%s: called\n", __FUNCTION__);
 
     memset(start_info, 0, sizeof(*start_info));
-    snprintf(start_info->magic, sizeof(start_info->magic), dom->guest_type);
+    strncpy(start_info->magic, dom->guest_type, sizeof(start_info->magic));
+    start_info->magic[sizeof(start_info->magic) - 1] = '\0';
     start_info->nr_pages = dom->total_pages;
     start_info->shared_info = shinfo << PAGE_SHIFT_X86;
     start_info->pt_base = dom->pgtables_seg.vstart;
@@ -457,7 +458,8 @@ static int start_info_x86_64(struct xc_d
     xc_dom_printf("%s: called\n", __FUNCTION__);
 
     memset(start_info, 0, sizeof(*start_info));
-    snprintf(start_info->magic, sizeof(start_info->magic), dom->guest_type);
+    strncpy(start_info->magic, dom->guest_type, sizeof(start_info->magic));
+    start_info->magic[sizeof(start_info->magic) - 1] = '\0';
     start_info->nr_pages = dom->total_pages;
     start_info->shared_info = shinfo << PAGE_SHIFT_X86;
     start_info->pt_base = dom->pgtables_seg.vstart;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel