Commit Diff


commit - 8d6dd58a06e247390a1ee15ad970fb7477e4ba0a
commit + a75af80d23b0ad23fbf368d8961a237c2e27f3aa
blob - 39dbb33d8979125c210be80665656ee2904ad4d7
blob + ad307549dfe244aead8140664d85dc8694246a09
--- FICS/gamedb.c
+++ FICS/gamedb.c
@@ -1733,17 +1733,24 @@ RemHist(char *who)
 				iter_no++;
 				continue;
 			}
-			/* Additional validation: only allow alphanumeric and underscores */
-			for (char *p = Opp; *p; ++p) {
-				if (!((*p >= 'a' && *p <= 'z') || (*p >= 'A' && *p <= 'Z') ||
-				      (*p >= '0' && *p <= '9') || *p == '_')) {
-					warnx("%s: Opp contains invalid character: '%s' (skipping)", __func__, Opp);
-					iter_no++;
+
+			/*
+			 * Additional validation: only allow
+			 * alphanumeric and underscores
+			 */
+			for (const char *p = Opp; *p; ++p) {
+				if (!((*p >= 'a' && *p <= 'z') ||
+				      (*p >= 'A' && *p <= 'Z') ||
+				      (*p >= '0' && *p <= '9') ||
+				      *p == '_')) {
+					warnx("%s: invalid characters found: "
+					    "Opp = '%s' (skipping)", __func__,
+					    Opp);
 					goto next_iter;
 				}
 			}
+
 			oppWhen = OldestHistGame(Opp);
-		next_iter:;
 
 			if (oppWhen > When || oppWhen <= 0L) {
 				char histfile[MAX_FILENAME_SIZE] = { '\0' };
@@ -1756,6 +1763,7 @@ RemHist(char *who)
 				}
 			}
 
+		  next_iter:
 			iter_no++;
 		}