]> Git Repo - qemu.git/commitdiff
qga: fix off-by-one length check
authorMarc-André Lureau <[email protected]>
Wed, 17 Feb 2016 16:47:54 +0000 (17:47 +0100)
committerMichael Roth <[email protected]>
Thu, 25 Feb 2016 15:48:51 +0000 (09:48 -0600)
Laszlo Ersek said: "The length check is off by one (in the safe direction); it
should be (nchars >= 2). The processing should be active for the wide string
L"\r\n" -- resulting in the empty wide string --, I believe."

Reported-by: Laszlo Ersek <[email protected]>
Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Reviewed-by: Michael Roth <[email protected]>
Signed-off-by: Michael Roth <[email protected]>
qga/commands-win32.c

index 2df1e2d61bb73e421e24631e118b04be8f326c5b..043ed684a49f5537229657d54a1e109d703b49ad 100644 (file)
@@ -1323,7 +1323,7 @@ get_net_error_message(gint error)
     if (msg != NULL) {
         nchars = wcslen(msg);
 
-        if (nchars > 2 &&
+        if (nchars >= 2 &&
             msg[nchars - 1] == L'\n' &&
             msg[nchars - 2] == L'\r') {
             msg[nchars - 2] = L'\0';
This page took 0.027411 seconds and 4 git commands to generate.