From 62904d82d51fe5d2534fe94773f4d155c071a266 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Fri, 28 Jun 2013 14:40:42 +0800 Subject: [PATCH 4/4] DBusString: fix a typo and check byte value strictly Signed-off-by: Chengwei Yang --- dbus/dbus-string.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dbus/dbus-string.c b/dbus/dbus-string.c index 52eb0f2..57367b2 100644 --- a/dbus/dbus-string.c +++ b/dbus/dbus-string.c @@ -977,7 +977,7 @@ do { \ dbus_bool_t _dbus_string_insert_2_aligned (DBusString *str, int insert_at, - const unsigned char octets[4]) + const unsigned char octets[2]) { DBUS_STRING_PREAMBLE (str); @@ -2235,6 +2235,9 @@ _dbus_string_append_byte_as_hex (DBusString *str, 'a', 'b', 'c', 'd', 'e', 'f' }; + if (byte < 0 || byte > 0xff) + return FALSE; + if (!_dbus_string_append_byte (str, hexdigits[(byte >> 4)])) return FALSE; -- 1.7.9.5