]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
_DBUS_STRING_DEFINE_STATIC: Don't include zero termination in length
authorSimon McVittie <smcv@collabora.com>
Mon, 6 Nov 2017 18:41:40 +0000 (18:41 +0000)
committerSimon McVittie <smcv@collabora.com>
Tue, 7 Nov 2017 11:37:48 +0000 (11:37 +0000)
_dbus_string_init_const() doesn't include the trailing '\0' in
the DBusRealString->len, so this surely shouldn't either.
In practice none of the users of _DBUS_STRING_DEFINE_STATIC care one
way or the other, but it seems better to be consistent.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104

dbus/dbus-string.h

index 1c01770209acb49ef5c5b976525210c8c606865d..2f78a04c0766d65f5ceff61f6de70c8005e60c0f 100644 (file)
@@ -402,7 +402,7 @@ _dbus_string_get_const_udata_len (const DBusString *str, int start, int len)
 #define _DBUS_STRING_DEFINE_STATIC(name, str)                           \
   static const char _dbus_static_string_##name[] = str;                 \
   static const DBusString name = { _dbus_static_string_##name,          \
-                                   sizeof(_dbus_static_string_##name) \
+                                   sizeof(_dbus_static_string_##name) - 1, \
                                    sizeof(_dbus_static_string_##name) + \
                                    _DBUS_STRING_ALLOCATION_PADDING,     \
                                    TRUE, TRUE, FALSE, 0 }