[Libvir] [PATCH] fix negative value handling of virConfParseLong()

Tatsuro Enokura fj7716hz at aa.jp.fujitsu.com
Fri Oct 19 09:01:06 UTC 2007


Hi,

I found a bug about negative value at virConfParseLong() in conf.c.
This patch fixes it.

Signed-off-by: Tatsuro Enokura <fj7716hz at aa.jp.fujitsu.com>

Thanks,
Tatsuro Enokura.

--------------------------------------------------------------------------
Index: libvirt/src/conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/conf.c,v
retrieving revision 1.11
diff -u -p -r1.11 conf.c
--- libvirt/src/conf.c  4 Jul 2007 09:16:23 -0000       1.11
+++ libvirt/src/conf.c  19 Oct 2007 08:37:36 -0000
@@ -345,6 +345,8 @@ virConfParseLong(virConfParserCtxtPtr ct
         l = l * 10 + (CUR - '0');
        NEXT;
     }
+    if (neg)
+        l *= -1;
     *val = l;
     return(0);
 }

--------------------------------------------------------------------------




More information about the libvir-list mailing list