WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Fix get_val_as_string so that it does not

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Fix get_val_as_string so that it does not truncate integers.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 11 Mar 2007 17:30:16 -0700
Delivery-date: Sun, 11 Mar 2007 17:29:58 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1173537666 0
# Node ID 798a7dc1ac6d39578dc3305dbe574e73f1b883ab
# Parent  6b057bdf0354700176163d12227f487d5c2f8a4e
Fix get_val_as_string so that it does not truncate integers.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/libxen/src/xen_common.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff -r 6b057bdf0354 -r 798a7dc1ac6d tools/libxen/src/xen_common.c
--- a/tools/libxen/src/xen_common.c     Sat Mar 10 14:16:52 2007 +0000
+++ b/tools/libxen/src/xen_common.c     Sat Mar 10 14:41:06 2007 +0000
@@ -110,7 +110,7 @@ static size_t size_of_member(const abstr
 static size_t size_of_member(const abstract_type *);
 
 static const char *
-get_val_as_string(const struct abstract_type *, void *, char *);
+get_val_as_string(const struct abstract_type *, void *, char *, size_t);
 
 
 void
@@ -1185,7 +1185,8 @@ add_struct_value(const struct abstract_t
     case INT:
     case ENUM:
     {
-        const char *val_as_string = get_val_as_string(type, value, buf);
+        const char *val_as_string =
+            get_val_as_string(type, value, buf, sizeof(buf));
         adder(node, key, "string", val_as_string);
     }
     break;
@@ -1257,7 +1258,7 @@ add_struct_value(const struct abstract_t
                 void *r_value = contents + (i * member_size) + r_offset;
 
                 const char *l_value_as_string =
-                    get_val_as_string(l_type, l_value, buf);
+                    get_val_as_string(l_type, l_value, buf, sizeof(buf));
 
                 add_struct_value(r_type, r_value, add_struct_member,
                                  l_value_as_string, struct_node);
@@ -1273,7 +1274,8 @@ add_struct_value(const struct abstract_t
 
 
 static const char *
-get_val_as_string(const struct abstract_type *type, void *value, char *buf)
+get_val_as_string(const struct abstract_type *type, void *value, char *buf,
+                  size_t bufsize)
 {
     switch (type->typename)
     {
@@ -1307,7 +1309,7 @@ get_val_as_string(const struct abstract_
     case INT:
     {
         int64_t val = *(int64_t *)value;
-        snprintf(buf, sizeof(buf), "%"PRId64, val);
+        snprintf(buf, bufsize, "%"PRId64, val);
         return buf;
     }
     break;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Fix get_val_as_string so that it does not truncate integers., Xen patchbot-unstable <=