]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vbox: Replace atoi with virStrToLong_i
authorMatthias Bolte <matthias.bolte@googlemail.com>
Tue, 30 Mar 2010 14:27:20 +0000 (16:27 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 1 Apr 2010 10:53:41 +0000 (12:53 +0200)
Parsing is stricter now and doesn't accept trailing characters
after the actual value or non-number strings anymore. atoi just
returns 0 in case it cannot parse a number from the given string.
Now an error is reported for such a string.

src/vbox/vbox_tmpl.c

index 05b075fddd194a173a809f8e1f9ba9386a305d42..14fdcdaea638a1b1235d831c4eb76bc1717f9507 100644 (file)
@@ -598,7 +598,9 @@ static int PRUnicharToInt(PRUnichar *strUtf16) {
     if (!strUtf8)
         return -1;
 
-    ret = atoi(strUtf8);
+    if (virStrToLong_i(strUtf8, NULL, 10, &ret) < 0)
+        ret = -1;
+
     g_pVBoxGlobalData->pFuncs->pfnUtf8Free(strUtf8);
 
     return ret;