Crashing bug in m_mkpasswd.c

Григор Йосифов grigorjosifov at gmail.com
Thu Apr 27 09:48:36 EDT 2006


Hello,
I've found a bug in the contributed module m_mkpasswd.c
When user or oper writes to the server:
/quote_mkpasswd_
(sybbol _ is for space) it crashes ...
* Disconnected (Remote host closed socket).
I looked at the source and found the line "if (parc < 1)". So I 
increased it to 2: "if (parc < 2)" and now there are no problems when 
there is space after the command.
Also there is mismatch in the help file of the same module:
 From the help:
MKPASSWD [DES|MD5] <plaintext>
As it really is in the module:
MKPASSWD <plaintext> [DES|MD5]
I also changed the notice that cames from the server to <plaintext> to 
sound the same way it is in the help file.

Regards,

Grigor Josifov

--- contrib/m_mkpasswd.c   Mon Mar 27 02:36:56 2006
+++ contrib/m_mkpasswd.c        Thu Apr 27 16:38:19 2006
@@ -52,7 +52,7 @@
 {
   static time_t last_used = 0;

-  if (parc < 1)
+  if (parc < 2)
   {
     sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
                me.name, source_p->name, "MKPASSWD");
@@ -81,7 +81,7 @@
                me.name, source_p->name, parv[1], crypt(parv[1],
                md5()));
   else
-    sendto_one(source_p, ":%s NOTICE %s :Syntax: MKPASSWD pass [DES|MD5]",
+    sendto_one(source_p, ":%s NOTICE %s :Syntax: MKPASSWD <plaintext> 
[DES|MD5]",
                me.name, source_p->name);
 }

@@ -94,7 +94,7 @@
 mo_mkpasswd(struct Client *client_p, struct Client *source_p,
             int parc, char *parv[])
 {
-  if (parc < 1)
+  if (parc < 2)
   {
     sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
                me.name, source_p->name, "MKPASSWD");
@@ -114,7 +114,7 @@
                me.name, source_p->name, parv[1], crypt(parv[1],
                md5()));
   else
-    sendto_one(source_p, ":%s NOTICE %s :Syntax: MKPASSWD pass [DES|MD5]",
+    sendto_one(source_p, ":%s NOTICE %s :Syntax: MKPASSWD <plaintext> 
[DES|MD5]",
                me.name, source_p->name);
 }





More information about the hybrid mailing list