aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2010-06-09 10:31:12 -0400
committerStefan Monnier2010-06-09 10:31:12 -0400
commite454a4a330cc6524cf0d2604b4fafc32d5bda795 (patch)
tree5ea60e93a09269c33ddf13e44a43dcac225c03f4 /src
parent989bc97f04f8143a7ab51088f9861da8d5df45f1 (diff)
downloademacs-e454a4a330cc6524cf0d2604b4fafc32d5bda795.tar.gz
emacs-e454a4a330cc6524cf0d2604b4fafc32d5bda795.zip
* dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
Check `object's type before accessing its guts.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/config.in65
-rw-r--r--src/dbusbind.c15
3 files changed, 53 insertions, 32 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9ba428053b9..35d68ae2599 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12010-06-09 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
4 Check `object's type before accessing its guts.
5
12010-06-08 Andreas Schwab <schwab@linux-m68k.org> 62010-06-08 Andreas Schwab <schwab@linux-m68k.org>
2 7
3 * minibuf.c (Fall_completions): Add more checks. 8 * minibuf.c (Fall_completions): Add more checks.
diff --git a/src/config.in b/src/config.in
index b321c586a4a..4667c0feb28 100644
--- a/src/config.in
+++ b/src/config.in
@@ -319,10 +319,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
319/* Define to 1 if you have the <kerberos/krb.h> header file. */ 319/* Define to 1 if you have the <kerberos/krb.h> header file. */
320#undef HAVE_KERBEROS_KRB_H 320#undef HAVE_KERBEROS_KRB_H
321 321
322/* Define to 1 if `e_text' is member of `krb5_error'. */ 322/* Define to 1 if `e_text' is a member of `krb5_error'. */
323#undef HAVE_KRB5_ERROR_E_TEXT 323#undef HAVE_KRB5_ERROR_E_TEXT
324 324
325/* Define to 1 if `text' is member of `krb5_error'. */ 325/* Define to 1 if `text' is a member of `krb5_error'. */
326#undef HAVE_KRB5_ERROR_TEXT 326#undef HAVE_KRB5_ERROR_TEXT
327 327
328/* Define to 1 if you have the <krb5.h> header file. */ 328/* 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/>. */
616/* Define to 1 if you have the `strsignal' function. */ 616/* Define to 1 if you have the `strsignal' function. */
617#undef HAVE_STRSIGNAL 617#undef HAVE_STRSIGNAL
618 618
619/* Define to 1 if `ifr_addr' is member of `struct ifreq'. */ 619/* Define to 1 if `ifr_addr' is a member of `struct ifreq'. */
620#undef HAVE_STRUCT_IFREQ_IFR_ADDR 620#undef HAVE_STRUCT_IFREQ_IFR_ADDR
621 621
622/* Define to 1 if `ifr_broadaddr' is member of `struct ifreq'. */ 622/* Define to 1 if `ifr_broadaddr' is a member of `struct ifreq'. */
623#undef HAVE_STRUCT_IFREQ_IFR_BROADADDR 623#undef HAVE_STRUCT_IFREQ_IFR_BROADADDR
624 624
625/* Define to 1 if `ifr_flags' is member of `struct ifreq'. */ 625/* Define to 1 if `ifr_flags' is a member of `struct ifreq'. */
626#undef HAVE_STRUCT_IFREQ_IFR_FLAGS 626#undef HAVE_STRUCT_IFREQ_IFR_FLAGS
627 627
628/* Define to 1 if `ifr_hwaddr' is member of `struct ifreq'. */ 628/* Define to 1 if `ifr_hwaddr' is a member of `struct ifreq'. */
629#undef HAVE_STRUCT_IFREQ_IFR_HWADDR 629#undef HAVE_STRUCT_IFREQ_IFR_HWADDR
630 630
631/* Define to 1 if `ifr_netmask' is member of `struct ifreq'. */ 631/* Define to 1 if `ifr_netmask' is a member of `struct ifreq'. */
632#undef HAVE_STRUCT_IFREQ_IFR_NETMASK 632#undef HAVE_STRUCT_IFREQ_IFR_NETMASK
633 633
634/* Define to 1 if `n_un.n_name' is member of `struct nlist'. */ 634/* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */
635#undef HAVE_STRUCT_NLIST_N_UN_N_NAME 635#undef HAVE_STRUCT_NLIST_N_UN_N_NAME
636 636
637/* Define to 1 if `tm_zone' is member of `struct tm'. */ 637/* Define to 1 if `tm_zone' is a member of `struct tm'. */
638#undef HAVE_STRUCT_TM_TM_ZONE 638#undef HAVE_STRUCT_TM_TM_ZONE
639 639
640/* Define to 1 if `struct utimbuf' is declared by <utime.h>. */ 640/* 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/>. */
858/* Define to the one symbol short name of this package. */ 858/* Define to the one symbol short name of this package. */
859#undef PACKAGE_TARNAME 859#undef PACKAGE_TARNAME
860 860
861/* Define to the home page for this package. */
862#undef PACKAGE_URL
863
861/* Define to the version of this package. */ 864/* Define to the version of this package. */
862#undef PACKAGE_VERSION 865#undef PACKAGE_VERSION
863 866
@@ -917,6 +920,28 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
917/* Define to 1 if using the Motif X toolkit. */ 920/* Define to 1 if using the Motif X toolkit. */
918#undef USE_MOTIF 921#undef USE_MOTIF
919 922
923/* Enable extensions on AIX 3, Interix. */
924#ifndef _ALL_SOURCE
925# undef _ALL_SOURCE
926#endif
927/* Enable GNU extensions on systems that have them. */
928#ifndef _GNU_SOURCE
929# undef _GNU_SOURCE
930#endif
931/* Enable threading extensions on Solaris. */
932#ifndef _POSIX_PTHREAD_SEMANTICS
933# undef _POSIX_PTHREAD_SEMANTICS
934#endif
935/* Enable extensions on HP NonStop. */
936#ifndef _TANDEM_SOURCE
937# undef _TANDEM_SOURCE
938#endif
939/* Enable general extensions on Solaris. */
940#ifndef __EXTENSIONS__
941# undef __EXTENSIONS__
942#endif
943
944
920/* Define to 1 if we should use toolkit scroll bars. */ 945/* Define to 1 if we should use toolkit scroll bars. */
921#undef USE_TOOLKIT_SCROLL_BARS 946#undef USE_TOOLKIT_SCROLL_BARS
922 947
@@ -952,28 +977,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
952/* Define to 1 if you need to in order for `stat' and other things to work. */ 977/* Define to 1 if you need to in order for `stat' and other things to work. */
953#undef _POSIX_SOURCE 978#undef _POSIX_SOURCE
954 979
955/* Enable extensions on AIX 3, Interix. */
956#ifndef _ALL_SOURCE
957# undef _ALL_SOURCE
958#endif
959/* Enable GNU extensions on systems that have them. */
960#ifndef _GNU_SOURCE
961# undef _GNU_SOURCE
962#endif
963/* Enable threading extensions on Solaris. */
964#ifndef _POSIX_PTHREAD_SEMANTICS
965# undef _POSIX_PTHREAD_SEMANTICS
966#endif
967/* Enable extensions on HP NonStop. */
968#ifndef _TANDEM_SOURCE
969# undef _TANDEM_SOURCE
970#endif
971/* Enable general extensions on Solaris. */
972#ifndef __EXTENSIONS__
973# undef __EXTENSIONS__
974#endif
975
976
977/* Define to rpl_ if the getopt replacement functions and variables should be 980/* Define to rpl_ if the getopt replacement functions and variables should be
978 used. */ 981 used. */
979#undef __GETOPT_PREFIX 982#undef __GETOPT_PREFIX
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 5cad182b525..f710741b591 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -405,6 +405,7 @@ xd_append_arg (dtype, object, iter)
405 switch (dtype) 405 switch (dtype)
406 { 406 {
407 case DBUS_TYPE_BYTE: 407 case DBUS_TYPE_BYTE:
408 CHECK_NUMBER (object);
408 { 409 {
409 unsigned char val = XUINT (object) & 0xFF; 410 unsigned char val = XUINT (object) & 0xFF;
410 XD_DEBUG_MESSAGE ("%c %d", dtype, val); 411 XD_DEBUG_MESSAGE ("%c %d", dtype, val);
@@ -423,6 +424,7 @@ xd_append_arg (dtype, object, iter)
423 } 424 }
424 425
425 case DBUS_TYPE_INT16: 426 case DBUS_TYPE_INT16:
427 CHECK_NUMBER (object);
426 { 428 {
427 dbus_int16_t val = XINT (object); 429 dbus_int16_t val = XINT (object);
428 XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); 430 XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val);
@@ -432,6 +434,7 @@ xd_append_arg (dtype, object, iter)
432 } 434 }
433 435
434 case DBUS_TYPE_UINT16: 436 case DBUS_TYPE_UINT16:
437 CHECK_NUMBER (object);
435 { 438 {
436 dbus_uint16_t val = XUINT (object); 439 dbus_uint16_t val = XUINT (object);
437 XD_DEBUG_MESSAGE ("%c %u", dtype, (unsigned int) val); 440 XD_DEBUG_MESSAGE ("%c %u", dtype, (unsigned int) val);
@@ -441,6 +444,7 @@ xd_append_arg (dtype, object, iter)
441 } 444 }
442 445
443 case DBUS_TYPE_INT32: 446 case DBUS_TYPE_INT32:
447 CHECK_NUMBER (object);
444 { 448 {
445 dbus_int32_t val = XINT (object); 449 dbus_int32_t val = XINT (object);
446 XD_DEBUG_MESSAGE ("%c %d", dtype, val); 450 XD_DEBUG_MESSAGE ("%c %d", dtype, val);
@@ -450,6 +454,7 @@ xd_append_arg (dtype, object, iter)
450 } 454 }
451 455
452 case DBUS_TYPE_UINT32: 456 case DBUS_TYPE_UINT32:
457 CHECK_NUMBER (object);
453 { 458 {
454 dbus_uint32_t val = XUINT (object); 459 dbus_uint32_t val = XUINT (object);
455 XD_DEBUG_MESSAGE ("%c %u", dtype, val); 460 XD_DEBUG_MESSAGE ("%c %u", dtype, val);
@@ -459,6 +464,7 @@ xd_append_arg (dtype, object, iter)
459 } 464 }
460 465
461 case DBUS_TYPE_INT64: 466 case DBUS_TYPE_INT64:
467 CHECK_NUMBER (object);
462 { 468 {
463 dbus_int64_t val = XINT (object); 469 dbus_int64_t val = XINT (object);
464 XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); 470 XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val);
@@ -468,6 +474,7 @@ xd_append_arg (dtype, object, iter)
468 } 474 }
469 475
470 case DBUS_TYPE_UINT64: 476 case DBUS_TYPE_UINT64:
477 CHECK_NUMBER (object);
471 { 478 {
472 dbus_uint64_t val = XUINT (object); 479 dbus_uint64_t val = XUINT (object);
473 XD_DEBUG_MESSAGE ("%c %u", dtype, (unsigned int) val); 480 XD_DEBUG_MESSAGE ("%c %u", dtype, (unsigned int) val);
@@ -477,6 +484,7 @@ xd_append_arg (dtype, object, iter)
477 } 484 }
478 485
479 case DBUS_TYPE_DOUBLE: 486 case DBUS_TYPE_DOUBLE:
487 CHECK_FLOAT (object);
480 { 488 {
481 double val = XFLOAT_DATA (object); 489 double val = XFLOAT_DATA (object);
482 XD_DEBUG_MESSAGE ("%c %f", dtype, val); 490 XD_DEBUG_MESSAGE ("%c %f", dtype, val);
@@ -488,8 +496,13 @@ xd_append_arg (dtype, object, iter)
488 case DBUS_TYPE_STRING: 496 case DBUS_TYPE_STRING:
489 case DBUS_TYPE_OBJECT_PATH: 497 case DBUS_TYPE_OBJECT_PATH:
490 case DBUS_TYPE_SIGNATURE: 498 case DBUS_TYPE_SIGNATURE:
499 CHECK_STRING (object);
491 { 500 {
492 char *val = SDATA (Fstring_make_unibyte (object)); 501 /* We need to send a valid UTF-8 string. We could encode `object'
502 but by not encoding it, we guarantee it's valid utf-8, even if
503 it contains eight-bit-bytes. Of course, you can still send
504 manually-crafted junk by passing a unibyte string. */
505 char *val = SDATA (object);
493 XD_DEBUG_MESSAGE ("%c %s", dtype, val); 506 XD_DEBUG_MESSAGE ("%c %s", dtype, val);
494 if (!dbus_message_iter_append_basic (iter, dtype, &val)) 507 if (!dbus_message_iter_append_basic (iter, dtype, &val))
495 XD_SIGNAL2 (build_string ("Unable to append argument"), object); 508 XD_SIGNAL2 (build_string ("Unable to append argument"), object);