[glib] win32: fix off-by-one length check
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] win32: fix off-by-one length check
- Date: Tue, 15 Mar 2016 10:36:07 +0000 (UTC)
commit a1bcd1e45a3eea98dedcee68f67b458e95e9193d
Author: Marc-André Lureau <marcandre lureau gmail com>
Date: Wed Feb 17 17:50:52 2016 +0100
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
glib/gwin32.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/glib/gwin32.c b/glib/gwin32.c
index 8c41aa6..06c6900 100644
--- a/glib/gwin32.c
+++ b/glib/gwin32.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]