diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2020-09-30 15:28:53 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2020-09-30 15:28:53 +0200 |
commit | b7224f9629ce549806ae3b4c974ce937bb20e840 (patch) | |
tree | cc61db97ecedb6da4e8aa75cffb1944a53bb77f1 /src/dbusbind.c | |
parent | 17ecfa8698096deb0cbd43889c6f0ded2584cce0 (diff) | |
download | emacs-b7224f9629ce549806ae3b4c974ce937bb20e840.tar.gz emacs-b7224f9629ce549806ae3b4c974ce937bb20e840.tar.bz2 emacs-b7224f9629ce549806ae3b4c974ce937bb20e840.zip |
Stricter checks for D-Bus compound types.
* src/dbusbind.c (XD_DBUS_TYPE_P, Fdbus__init_bus)
(xd_read_queued_messages): Use Fkeywordp instead of SYMBOLP.
(xd_signature): Stricter checks for compound types.
* test/lisp/net/dbus-tests.el (dbus-test01-compound-types): Extend test.
Diffstat (limited to 'src/dbusbind.c')
-rw-r--r-- | src/dbusbind.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/dbusbind.c b/src/dbusbind.c index b06077d3b58..36f86556944 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -211,7 +211,7 @@ xd_dbus_type_to_symbol (int type) /* Check whether a Lisp symbol is a predefined D-Bus type symbol. */ #define XD_DBUS_TYPE_P(object) \ - (SYMBOLP (object) && ((xd_symbol_to_dbus_type (object) != DBUS_TYPE_INVALID))) + Fkeywordp (object) && ((xd_symbol_to_dbus_type (object) != DBUS_TYPE_INVALID)) /* Determine the DBusType of a given Lisp OBJECT. It is used to convert Lisp objects, being arguments of `dbus-call-method' or @@ -463,6 +463,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object) CHECK_CONS (object); elt = XD_NEXT_VALUE (elt); + CHECK_CONS (elt); subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); @@ -474,11 +475,12 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object) break; case DBUS_TYPE_STRUCT: - /* A struct list might contain any number of elements with - different types. No further check needed. */ + /* A struct list might contain any (but zero) number of elements + with different types. No further check needed. */ CHECK_CONS (object); elt = XD_NEXT_VALUE (elt); + CHECK_CONS (elt); /* Compose the signature from the elements. It is enclosed by parentheses. */ @@ -509,6 +511,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object) /* First element. */ elt = XD_NEXT_VALUE (elt); + CHECK_CONS (elt); subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); xd_signature_cat (signature, x); @@ -518,6 +521,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object) /* Second element. */ elt = CDR_SAFE (XD_NEXT_VALUE (elt)); + CHECK_CONS (elt); subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); xd_signature_cat (signature, x); @@ -1227,7 +1231,7 @@ this connection to those buses. */) xd_add_watch, xd_remove_watch, xd_toggle_watch, - SYMBOLP (bus) + Fkeywordp (bus) ? (void *) XSYMBOL (bus) : (void *) XSTRING (bus), NULL)) @@ -1793,7 +1797,7 @@ xd_read_queued_messages (int fd, void *data) while (!NILP (busp)) { key = CAR_SAFE (CAR_SAFE (busp)); - if ((SYMBOLP (key) && XSYMBOL (key) == data) + if ((Fkeywordp (key) && XSYMBOL (key) == data) || (STRINGP (key) && XSTRING (key) == data)) bus = key; busp = CDR_SAFE (busp); |