* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.

Check `object's type before accessing its guts.
This commit is contained in:
Stefan Monnier 2010-06-09 10:31:12 -04:00
parent 989bc97f04
commit e454a4a330
3 changed files with 53 additions and 32 deletions

View file

@ -1,3 +1,8 @@
2010-06-09 Stefan Monnier <monnier@iro.umontreal.ca>
* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
Check `object's type before accessing its guts.
2010-06-08 Andreas Schwab <schwab@linux-m68k.org>
* minibuf.c (Fall_completions): Add more checks.

View file

@ -319,10 +319,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the <kerberos/krb.h> header file. */
#undef HAVE_KERBEROS_KRB_H
/* Define to 1 if `e_text' is member of `krb5_error'. */
/* Define to 1 if `e_text' is a member of `krb5_error'. */
#undef HAVE_KRB5_ERROR_E_TEXT
/* Define to 1 if `text' is member of `krb5_error'. */
/* Define to 1 if `text' is a member of `krb5_error'. */
#undef HAVE_KRB5_ERROR_TEXT
/* Define to 1 if you have the <krb5.h> header file. */
@ -616,25 +616,25 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the `strsignal' function. */
#undef HAVE_STRSIGNAL
/* Define to 1 if `ifr_addr' is member of `struct ifreq'. */
/* Define to 1 if `ifr_addr' is a member of `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ_IFR_ADDR
/* Define to 1 if `ifr_broadaddr' is member of `struct ifreq'. */
/* Define to 1 if `ifr_broadaddr' is a member of `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ_IFR_BROADADDR
/* Define to 1 if `ifr_flags' is member of `struct ifreq'. */
/* Define to 1 if `ifr_flags' is a member of `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ_IFR_FLAGS
/* Define to 1 if `ifr_hwaddr' is member of `struct ifreq'. */
/* Define to 1 if `ifr_hwaddr' is a member of `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ_IFR_HWADDR
/* Define to 1 if `ifr_netmask' is member of `struct ifreq'. */
/* Define to 1 if `ifr_netmask' is a member of `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ_IFR_NETMASK
/* Define to 1 if `n_un.n_name' is member of `struct nlist'. */
/* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */
#undef HAVE_STRUCT_NLIST_N_UN_N_NAME
/* Define to 1 if `tm_zone' is member of `struct tm'. */
/* Define to 1 if `tm_zone' is a member of `struct tm'. */
#undef HAVE_STRUCT_TM_TM_ZONE
/* Define to 1 if `struct utimbuf' is declared by <utime.h>. */
@ -858,6 +858,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
@ -917,6 +920,28 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if using the Motif X toolkit. */
#undef USE_MOTIF
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Define to 1 if we should use toolkit scroll bars. */
#undef USE_TOOLKIT_SCROLL_BARS
@ -952,28 +977,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Define to rpl_ if the getopt replacement functions and variables should be
used. */
#undef __GETOPT_PREFIX

View file

@ -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);