From 2f047d4816591932c132f27564b7905efd757fdd Mon Sep 17 00:00:00 2001 From: Matthias Bolte Date: Tue, 30 Mar 2010 16:27:20 +0200 Subject: [PATCH] vbox: Replace atoi with virStrToLong_i 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 05b075fddd..14fdcdaea6 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -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;