summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2009-07-10 19:26:52 -0400
committerColin Walters <walters@verbum.org>2009-07-10 19:26:52 -0400
commit1f6ac4deef91df3130c61525a2800e6b8a0ddcbf (patch)
tree450e009c21de8bc53eb382813ddb02d66e954fc7 /dbus
parente5310abd6cbc4c2e1a9df54f097d6642ad0833c6 (diff)
Bug 21646 - Fix a signed char comparison
Original suggested patch from Marc-Andre Lureau <marcandre.lureau@gmail.com> Explicitly cast to unsigned char before we do comparisons.
Diffstat (limited to 'dbus')
-rw-r--r--dbus/dbus-sysdeps-util-unix.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c
index f1e20334..07efdfe0 100644
--- a/dbus/dbus-sysdeps-util-unix.c
+++ b/dbus/dbus-sysdeps-util-unix.c
@@ -1149,10 +1149,13 @@ string_squash_nonprintable (DBusString *str)
len = _dbus_string_get_length (str);
for (i = 0; i < len; i++)
- if (buf[i] == '\0')
- buf[i] = ' ';
- else if (buf[i] < 0x20 || buf[i] > 127)
- buf[i] = '?';
+ {
+ unsigned char c = (unsigned char) buf[i];
+ if (c == '\0')
+ c = ' ';
+ else if (c < 0x20 || c > 127)
+ c = '?';
+ }
}
/**