Fix searching of ']'
authorWilfried Goesgens <dothebart@citadel.org>
Thu, 31 Mar 2011 22:50:43 +0000 (00:50 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Thu, 31 Mar 2011 22:50:43 +0000 (00:50 +0200)
citadel/modules/network/serv_network.c

index 5c5625b5c6d1ad5e17d141f813568b86f0e115f1..1df6dfd6f47d7a0f91aec88787330637a4e60fc5 100644 (file)
@@ -715,17 +715,17 @@ void network_spool_msg(long msgnum, void *userdata) {
                                msg->cm_fields['U'] = strdup("(no subject)");
                        }
                        
-                       len = strlen(msg->cm_fields['U']);
-                       pCh = strstr(msg->cm_fields['U'], CC->room.QRname);
+                       len  = strlen(msg->cm_fields['U']);
+                       rlen = strlen(CC->room.QRname);
+                       pCh  = strstr(msg->cm_fields['U'], CC->room.QRname);
                        if ((pCh == NULL) ||
-                           (*(pCh + len) != ']') ||
+                           (*(pCh + rlen) != ']') ||
                            (pCh == msg->cm_fields['U']) ||
                            (*(pCh - 1) != '[')
                                )
                        {
                                char *pBuff;
 
-                               rlen = strlen(CC->room.QRname);
                                rlen += len + 4;
                                pBuff = malloc (rlen * sizeof(char));