mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-08 21:58:03 +02:00
dbus-nonce: check results of _dbus_string_init for OOM
Origin: vendor, Maemo Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33128 Bug-NB: NB#180486 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
This commit is contained in:
parent
84d4ed242a
commit
6520ecde58
1 changed files with 7 additions and 2 deletions
|
|
@ -137,7 +137,8 @@ _dbus_accept_with_noncefile (int listen_fd, const DBusNonceFile *noncefile)
|
|||
DBusString nonce;
|
||||
|
||||
_dbus_assert (noncefile != NULL);
|
||||
_dbus_string_init (&nonce);
|
||||
if (!_dbus_string_init (&nonce))
|
||||
return -1;
|
||||
//PENDING(kdab): set better errors
|
||||
if (_dbus_read_nonce (_dbus_noncefile_get_path(noncefile), &nonce, NULL) != TRUE)
|
||||
return -1;
|
||||
|
|
@ -161,7 +162,11 @@ generate_and_write_nonce (const DBusString *filename, DBusError *error)
|
|||
|
||||
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
|
||||
|
||||
_dbus_string_init (&nonce);
|
||||
if (!_dbus_string_init (&nonce))
|
||||
{
|
||||
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!_dbus_generate_random_bytes (&nonce, 16))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue