]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/pop3/serv_pop3.c
apply memset-0 fix here too.
[citadel.git] / citadel / modules / pop3 / serv_pop3.c
index 5d8ef5ad755e0daf72fe5575b1ad0d0f79fe94fd..55cfc98ecab3f30c1cf63c3d4cb8acb8da64ca9c 100644 (file)
@@ -62,7 +62,6 @@
 #include "support.h"
 #include "config.h"
 #include "user_ops.h"
-#include "policy.h"
 #include "database.h"
 #include "msgbase.h"
 #include "internet_addressing.h"
@@ -186,7 +185,7 @@ void pop3_add_message(long msgnum, void *userdata) {
  * of messages in the inbox, or -1 for error)
  */
 int pop3_grab_mailbox(void) {
-        struct visit vbuf;
+        visit vbuf;
        int i;
 
        if (CtdlGetRoom(&CC->room, MAILROOM) != 0) return(-1);
@@ -251,7 +250,7 @@ void pop3_apop(char *argbuf)
    strncpy(username, argbuf, sizeof(username)-1);
    username[sizeof(username)-1] = '\0';
    
-   memset(userdigest, MD5_HEXSTRING_SIZE, 0);
+   memset(userdigest, 0, MD5_HEXSTRING_SIZE);
    strncpy(userdigest, sptr, MD5_HEXSTRING_SIZE-1);
    
    if (CtdlLoginExistingUser(NULL, username) != login_ok)
@@ -285,11 +284,11 @@ void pop3_apop(char *argbuf)
 void pop3_pass(char *argbuf) {
        char password[SIZ];
 
-       strcpy(password, argbuf);
+       safestrncpy(password, argbuf, sizeof password);
        striplt(password);
 
        /* CtdlLogPrintf(CTDL_DEBUG, "Trying <%s>\n", password); */
-       if (CtdlTryPassword(password) == pass_ok) {
+       if (CtdlTryPassword(password, strlen(password)) == pass_ok) {
                pop3_login();
        }
        else {
@@ -421,7 +420,7 @@ void pop3_top(char *argbuf) {
        cprintf("+OK Message %d:\r\n", which_one);
        
        ptr = ChrPtr(msgtext);
-       while (ptr = memreadline(ptr, buf, (sizeof buf - 2)),
+       while (ptr = cmemreadline(ptr, buf, (sizeof buf - 2)),
              ( (*ptr != 0) && (done == 0))) {
                strcat(buf, "\r\n");
                if (in_body == 1) {
@@ -473,7 +472,7 @@ void pop3_dele(char *argbuf) {
  */
 void pop3_update(void) {
        int i;
-        struct visit vbuf;
+        visit vbuf;
 
        long *deletemsgs = NULL;
        int num_deletemsgs = 0;