From 1a339033f34d0ce6719ef4f5308b757ef43cbfd2 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sun, 27 May 2012 23:05:12 +0200 Subject: [PATCH] Fix generating invalid UIDs after current_uid is 000Z99999 (next UID became 000[AAAAA) --- src/server.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/server.cpp b/src/server.cpp index dab920bb6..092826361 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -101,20 +101,12 @@ void InspIRCd::IncrementUID(int pos) * A again, in an iterative fashion.. so.. * AAA9 -> AABA, and so on. -- w00t */ - if (pos == 3) + if ((pos == 3) && (current_uid[3] == '9')) { // At pos 3, if we hit '9', we've run out of available UIDs, and need to reset to AAA..AAA. - if (current_uid[pos] == '9') + for (int i = 3; i < UUID_LENGTH-1; i++) { - for (int i = 3; i < (UUID_LENGTH - 1); i++) - { - current_uid[i] = 'A'; - } - } - else - { - // Buf if we haven't, just keep incrementing merrily. - current_uid[pos]++; + current_uid[i] = 'A'; } } else -- 2.39.5