unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* dbusbind.c SIGSEGV fix and minor cleanup
@ 2008-03-18  9:47 David Hansen
  2008-03-21  2:00 ` David Hansen
  2008-03-21 16:27 ` Michael Albinus
  0 siblings, 2 replies; 5+ messages in thread
From: David Hansen @ 2008-03-18  9:47 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 218 bytes --]

Hello,

emacs crashes (in `strcpy') when receiving dbus messages with some empty
content.

The attached patch fixes this.  Also there is no need to copy the
strings.  This is already be done by `build_string'.

David


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2794 bytes --]

*** dbusbind.c.~1.22.~	2008-02-17 01:40:28.000000000 +0100
--- dbusbind.c	2008-03-18 10:35:30.000000000 +0100
***************
*** 1140,1149 ****
    DBusMessageIter iter;
    unsigned int dtype;
    int mtype;
!   char uname[DBUS_MAXIMUM_NAME_LENGTH];
!   char path[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; /* Unlimited in D-Bus spec.  */
!   char interface[DBUS_MAXIMUM_NAME_LENGTH];
!   char member[DBUS_MAXIMUM_NAME_LENGTH];
  
    /* Open a connection to the bus.  */
    connection = xd_initialize (bus);
--- 1140,1146 ----
    DBusMessageIter iter;
    unsigned int dtype;
    int mtype;
!   const char *uname, *path, *interface, *member;
  
    /* Open a connection to the bus.  */
    connection = xd_initialize (bus);
***************
*** 1175,1185 ****
  
    /* Read message type, unique name, object path, interface and member
       from the message.  */
!   mtype =            dbus_message_get_type (dmessage);
!   strcpy (uname,     dbus_message_get_sender (dmessage));
!   strcpy (path,      dbus_message_get_path (dmessage));
!   strcpy (interface, dbus_message_get_interface (dmessage));
!   strcpy (member,    dbus_message_get_member (dmessage));
  
    XD_DEBUG_MESSAGE ("Event received: %d %s %s %s %s %s",
  		    mtype, uname, path, interface, member,
--- 1172,1186 ----
  
    /* Read message type, unique name, object path, interface and member
       from the message.  */
!   mtype     = dbus_message_get_type (dmessage);
!   uname     = dbus_message_get_sender (dmessage);
!   path      = dbus_message_get_path (dmessage);
!   interface = dbus_message_get_interface (dmessage);
!   member    = dbus_message_get_member (dmessage);
! 
!   /* dbus-registered-functions-table requires non nil interface and member. */
!   if ((NULL == interface) || (NULL == member))
!     RETURN_UNGCPRO (Qnil);
  
    XD_DEBUG_MESSAGE ("Event received: %d %s %s %s %s %s",
  		    mtype, uname, path, interface, member,
***************
*** 1210,1220 ****
  			     args);
  
  	  /* Add uname, path, interface and member to the event.  */
! 	  event.arg = Fcons ((member == NULL ? Qnil : build_string (member)),
! 			     event.arg);
! 	  event.arg = Fcons ((interface == NULL
! 			      ? Qnil : build_string (interface)),
! 			     event.arg);
  	  event.arg = Fcons ((path == NULL ? Qnil : build_string (path)),
  			     event.arg);
  	  event.arg = Fcons ((uname == NULL ? Qnil : build_string (uname)),
--- 1211,1218 ----
  			     args);
  
  	  /* Add uname, path, interface and member to the event.  */
! 	  event.arg = Fcons (build_string (member), event.arg);
! 	  event.arg = Fcons (build_string (interface), event.arg);
  	  event.arg = Fcons ((path == NULL ? Qnil : build_string (path)),
  			     event.arg);
  	  event.arg = Fcons ((uname == NULL ? Qnil : build_string (uname)),

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-03-23 16:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-18  9:47 dbusbind.c SIGSEGV fix and minor cleanup David Hansen
2008-03-21  2:00 ` David Hansen
2008-03-21 16:27 ` Michael Albinus
2008-03-22 12:55   ` David Hansen
2008-03-23 16:55     ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).