tidied up advtopic code
authorpk910 <philipp@zoelle1.de>
Sat, 3 Mar 2012 08:53:35 +0000 (09:53 +0100)
committerpk910 <philipp@zoelle1.de>
Sat, 3 Mar 2012 08:53:35 +0000 (09:53 +0100)
src/chanserv.c
src/chanserv.h

index d50c9147fbe56909b65f776179f763e99bb2ca8d..4e41784b0aa289a7506251bd28bb6667740dcf5a 100644 (file)
@@ -4446,7 +4446,6 @@ static CHANSERV_FUNC(cmd_topic)
                             new_topic[dpos++] = *ptr; //is % again
                             break;
                         }
-                        ptr--;
                         advtopic_index--; //no zero base
                         if(!cData->advtopic[advtopic_index])
                             break; //just leave it empty
@@ -4458,11 +4457,12 @@ static CHANSERV_FUNC(cmd_topic)
                         break;
                     case '\\': 
                         ptr++; /* and fall through */
+                        if(!*ptr) break;
                     default:
                         new_topic[dpos++] = *ptr;
+                        ptr++;
                         break;
                     }
-                    ptr++;
                 }
             } else {
                 while((tchar = topic_mask[pos++]) && (dpos <= TOPICLEN))
index 2aba69cc1277bc3b42703723a5aa8ca4195cf6a5..638a77f2777eb93582fb7852cdc73af509deaf49 100644 (file)
@@ -109,7 +109,7 @@ struct chanData
     unsigned short      lvlOpts[NUM_LEVEL_OPTIONS];
     unsigned char       chOpts[NUM_CHAR_OPTIONS];
 
-    char *advtopic[9];
+    char *advtopic[MAXADVTOPICENTRIES];
 
     struct userData     *users;
     struct banData      *bans;