summaryrefslogtreecommitdiff
path: root/src/dbusbind.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2010-06-10 00:08:50 +0200
committerAndreas Schwab <schwab@linux-m68k.org>2010-06-10 00:08:50 +0200
commit639b2760f19231881f753c8f1f7822eab457c751 (patch)
treee18ffb6ca9d3ed2ad8cf2e38de2caa44e52efaaa /src/dbusbind.c
parentc1b1acc2f7a3b658407afe4562a88ea8c62671d9 (diff)
parente454a4a330cc6524cf0d2604b4fafc32d5bda795 (diff)
downloademacs-639b2760f19231881f753c8f1f7822eab457c751.tar.gz
Merge from emacs-23
Diffstat (limited to 'src/dbusbind.c')
-rw-r--r--src/dbusbind.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/dbusbind.c b/src/dbusbind.c
index a72a95552bc..e813d0b5ad8 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -405,6 +405,7 @@ xd_append_arg (dtype, object, iter)
switch (dtype)
{
case DBUS_TYPE_BYTE:
+ CHECK_NUMBER (object);
{
unsigned char val = XUINT (object) & 0xFF;
XD_DEBUG_MESSAGE ("%c %d", dtype, val);
@@ -423,6 +424,7 @@ xd_append_arg (dtype, object, iter)
}
case DBUS_TYPE_INT16:
+ CHECK_NUMBER (object);
{
dbus_int16_t val = XINT (object);
XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val);
@@ -432,6 +434,7 @@ xd_append_arg (dtype, object, iter)
}
case DBUS_TYPE_UINT16:
+ CHECK_NUMBER (object);
{
dbus_uint16_t val = XUINT (object);
XD_DEBUG_MESSAGE ("%c %u", dtype, (unsigned int) val);
@@ -441,6 +444,7 @@ xd_append_arg (dtype, object, iter)
}
case DBUS_TYPE_INT32:
+ CHECK_NUMBER (object);
{
dbus_int32_t val = XINT (object);
XD_DEBUG_MESSAGE ("%c %d", dtype, val);
@@ -450,6 +454,7 @@ xd_append_arg (dtype, object, iter)
}
case DBUS_TYPE_UINT32:
+ CHECK_NUMBER (object);
{
dbus_uint32_t val = XUINT (object);
XD_DEBUG_MESSAGE ("%c %u", dtype, val);
@@ -459,6 +464,7 @@ xd_append_arg (dtype, object, iter)
}
case DBUS_TYPE_INT64:
+ CHECK_NUMBER (object);
{
dbus_int64_t val = XINT (object);
XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val);
@@ -468,6 +474,7 @@ xd_append_arg (dtype, object, iter)
}
case DBUS_TYPE_UINT64:
+ CHECK_NUMBER (object);
{
dbus_uint64_t val = XUINT (object);
XD_DEBUG_MESSAGE ("%c %u", dtype, (unsigned int) val);
@@ -477,6 +484,7 @@ xd_append_arg (dtype, object, iter)
}
case DBUS_TYPE_DOUBLE:
+ CHECK_FLOAT (object);
{
double val = XFLOAT_DATA (object);
XD_DEBUG_MESSAGE ("%c %f", dtype, val);
@@ -488,8 +496,13 @@ xd_append_arg (dtype, object, iter)
case DBUS_TYPE_STRING:
case DBUS_TYPE_OBJECT_PATH:
case DBUS_TYPE_SIGNATURE:
+ CHECK_STRING (object);
{
- char *val = SDATA (Fstring_make_unibyte (object));
+ /* We need to send a valid UTF-8 string. We could encode `object'
+ but by not encoding it, we guarantee it's valid utf-8, even if
+ it contains eight-bit-bytes. Of course, you can still send
+ manually-crafted junk by passing a unibyte string. */
+ char *val = SDATA (object);
XD_DEBUG_MESSAGE ("%c %s", dtype, val);
if (!dbus_message_iter_append_basic (iter, dtype, &val))
XD_SIGNAL2 (build_string ("Unable to append argument"), object);