summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-string.h
diff options
context:
space:
mode:
authorHavoc Pennington <hp@localhost.localdomain>2007-10-31 13:58:28 -0400
committerHavoc Pennington <hp@localhost.localdomain>2007-10-31 13:58:28 -0400
commitbef4260ad58bc9eb75e2e1a52ad9b49bc3c70fa5 (patch)
treea1cabf96f8f525936ebdc1ab88100b5598fd397f /dbus/dbus-string.h
parent5340b8de0b537380e0c445495300739d75abeb2f (diff)
Fix a problem where a nul byte was wrongly introduced into UUIDs, due to _dbus_string_copy_to_buffer weird behavior.
2007-10-31 Havoc Pennington <hp@redhat.com> * bus/selinux.c (log_audit_callback): rewrite to use _dbus_string_copy_to_buffer_with_nul() * dbus/dbus-string.c (_dbus_string_copy_to_buffer): change to NOT nul-terminate the buffer; fail an assertion if there is not enough space in the target buffer. This fixes two bugs where copy_to_buffer was used to copy the binary bytes in a UUID, where nul termination did not make sense. Bug reported by David Castelow. (_dbus_string_copy_to_buffer_with_nul): new function that always nul-terminates the buffer, and fails an assertion if there is not enough space in the buffer.
Diffstat (limited to 'dbus/dbus-string.h')
-rw-r--r--dbus/dbus-string.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/dbus/dbus-string.h b/dbus/dbus-string.h
index b0100f3a..d88d67ed 100644
--- a/dbus/dbus-string.h
+++ b/dbus/dbus-string.h
@@ -120,6 +120,9 @@ dbus_bool_t _dbus_string_copy_data_len (const DBusString *str,
void _dbus_string_copy_to_buffer (const DBusString *str,
char *buffer,
int len);
+void _dbus_string_copy_to_buffer_with_nul (const DBusString *str,
+ char *buffer,
+ int avail_len);
#ifndef _dbus_string_get_length
int _dbus_string_get_length (const DBusString *str);
#endif /* !_dbus_string_get_length */