]> jfr.im git - irc/evilnet/x3.git/commitdiff
Fix for a couple of crash bugs
authorMatthew Beeching <redacted>
Thu, 26 Jan 2012 20:31:44 +0000 (20:31 +0000)
committerMatthew Beeching <redacted>
Thu, 26 Jan 2012 20:31:44 +0000 (20:31 +0000)
ChangeLog
src/dict-splay.c
src/tools.c

index 373b30e7becb89f8b6f2ac1e87dd852ffb9f403f..83a768329b98509f544ec4bf0c1ca48b6c555e37 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
 /***********************************************************************
 X3 ChangeLog
 
+2012-01-26  Matthew Beeching  <jobe@mdbnet.co.uk>
+
+       * src/dict-splay.c: Fix for possible crash bugs in dict_splay()
+       and dict_remove2();
+
+       * src/tools.c: Fix for crash bug in irccasecmp();
+
 2012-01-24  Matthew Beeching  <jobe@mdbnet.co.uk>
 
        * src/proto-p10.c: Fixed irc_topic() to honour server/hidden_host_type
index 2e6f3a1dc3c2e4a95aad3252bb6f571917b5a9a1..1e473503666e39b0e22a102c2b27bc5a6df0672b 100644 (file)
@@ -78,6 +78,7 @@ dict_splay(struct dict_node *node, const char *key)
     int res;
 
     if (!node) return NULL;
+    if (!key) return NULL;
     N.l = N.r = NULL;
     l = r = &N;
 
@@ -228,6 +229,7 @@ dict_remove2(dict_t dict, const char *key, int no_dispose)
 
     if (!dict->root)
         return 0;
+    if (!key) return 0;
     verify(dict);
     dict->root = dict_splay(dict->root, key);
     if (irccasecmp(key, dict->root->key))
index 3dd81b787e2936fedc300f353999c9cbcb8cd88e..357c1c7c3f6eb35a6c66d4957988947115c932f6 100644 (file)
@@ -367,6 +367,10 @@ irc_strtolower(char *str) {
 
 int
 irccasecmp(const char *stra, const char *strb) {
+    if (!stra)
+      return -1;
+    if (!strb)
+      return 1;
     while (*stra && (tolower(*stra) == tolower(*strb)))
         stra++, strb++;
     return tolower(*stra) - tolower(*strb);