diff options
author | Havoc Pennington <hp@redhat.com> | 2002-12-08 03:25:25 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2002-12-08 03:25:25 +0000 |
commit | a4fabb460b9a2ee2760295ccfc7b4674315f4476 (patch) | |
tree | 945271378c3286a65d220bfbca435955422d2512 | |
parent | 6ecd335003741c010998e906e7d04451e2c85713 (diff) | |
download | startup-notification-a4fabb460b9a2ee2760295ccfc7b4674315f4476.tar.gz |
handle zero-length string properly, avoids a crash
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | libsn/sn-launchee.c | 2 | ||||
-rw-r--r-- | libsn/sn-util.c | 3 | ||||
-rw-r--r-- | libsn/sn-xmessages.c | 9 |
4 files changed, 15 insertions, 4 deletions
@@ -1,3 +1,8 @@ +2002-12-07 Havoc Pennington <hp@pobox.com> + + * libsn/sn-xmessages.c (sn_internal_append_to_string_escaped): + handle zero-length string properly, avoids a crash + 2002-12-02 Havoc Pennington <hp@redhat.com> * doc/Makefile.am (EXTRA_DIST): dist the startup-notification.txt diff --git a/libsn/sn-launchee.c b/libsn/sn-launchee.c index fdb5ae4..275ac0b 100644 --- a/libsn/sn-launchee.c +++ b/libsn/sn-launchee.c @@ -146,7 +146,7 @@ sn_launchee_context_complete (SnLauncheeContext *context) message = sn_internal_serialize_message ("remove", (const char**) keys, - (const char **) vals); + (const char**) vals); sn_internal_broadcast_xmessage (context->display, context->screen, diff --git a/libsn/sn-util.c b/libsn/sn-util.c index 775df13..7d12bfa 100644 --- a/libsn/sn-util.c +++ b/libsn/sn-util.c @@ -25,6 +25,7 @@ #include <stdio.h> #include <string.h> #include <errno.h> +#include <assert.h> #ifndef REALLOC_0_WORKS static void* @@ -317,6 +318,8 @@ sn_internal_append_to_string (char **append_to, { int len; char *end; + + assert (append != NULL); len = strlen (append); diff --git a/libsn/sn-xmessages.c b/libsn/sn-xmessages.c index c86db27..ddbf36b 100644 --- a/libsn/sn-xmessages.c +++ b/libsn/sn-xmessages.c @@ -484,9 +484,12 @@ sn_internal_append_to_string_escaped (char **append_to, ++p; } - sn_internal_append_to_string (append_to, current_len, escaped); - - sn_free (escaped); + if (escaped != NULL) + { + sn_internal_append_to_string (append_to, current_len, escaped); + + sn_free (escaped); + } } char* |