mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 03:46:17 +01:00
win32: fix off-by-one length check
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 <lersek@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> https://bugzilla.gnome.org/show_bug.cgi?id=762202
This commit is contained in:
parent
0a580fc79e
commit
a1bcd1e45a
@ -203,7 +203,7 @@ g_win32_error_message (gint error)
|
||||
{
|
||||
nchars = wcslen (msg);
|
||||
|
||||
if (nchars > 2 && msg[nchars-1] == '\n' && msg[nchars-2] == '\r')
|
||||
if (nchars >= 2 && msg[nchars-1] == '\n' && msg[nchars-2] == '\r')
|
||||
msg[nchars-2] = '\0';
|
||||
|
||||
retval = g_utf16_to_utf8 (msg, -1, NULL, NULL, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user