Improve the clean-up of outdated IAuth instances on rehash (SF bug #2789656).
[ircu2.10.12-pk.git] / ircd / m_pass.c
index b1aef623d5db41aacc70cbf26b7f965e8187fb56..eb08e9f6b6a22a36b0e77947e56721480de1692e 100644 (file)
@@ -112,7 +112,9 @@ int mr_pass(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     len += strlen(parv[arg]);
     password[len++] = ' ';
   }
-  password[--len] = '\0';
+  if (len > 0)
+    --len;
+  password[len] = '\0';
 
   if (EmptyString(password))
     return need_more_params(cptr, "PASS");