summaryrefslogtreecommitdiff
path: root/net-irc/eggdrop/files/eggdrop-1.8.4-fix-array-bounds-warning.patch
blob: 7c6c2d6dae698b5970c7a227f2f9edd8c528cdd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
diff --git a/src/flags.c b/src/flags.c
index 8cecd2898..3f0a7ea32 100644
--- a/src/flags.c
+++ b/src/flags.c
@@ -403,7 +403,10 @@ void break_down_flags(const char *string, struct flag_record *plus,
       which = plus;
       mode++;
       if ((mode == 2) && !(flags & (FR_CHAN | FR_BOT)))
-        string = "";
+        goto breakout; /* string = ""; does not work here because we need to
+                          break out of while() / nested switch(), see
+                          "string++;" below and string = "\0"; is worse than
+                          goto */
       else if (mode == 3)
         mode = 1;
       break;
@@ -447,6 +450,7 @@ void break_down_flags(const char *string, struct flag_record *plus,
     }
     string++;
   }
+breakout:
   for (which = plus; which; which = (which == plus ? minus : 0)) {
     which->global &=USER_VALID;