dont strncpy a null password
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 12 Jan 2010 03:05:09 +0000 (14:05 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 12 Jan 2010 03:05:09 +0000 (14:05 +1100)
smb.c

diff --git a/smb.c b/smb.c
index 84bac8e95a20b168744f26d6bf7b4e2a12837b47..b731d4f48b63f45b7cbaeadb3ebc63bc62537a80 100644 (file)
--- a/smb.c
+++ b/smb.c
@@ -285,7 +285,9 @@ void smb_auth_fn(const char *server, const char *share, char *wrkgrp, int wrkgrp
                strncpy(wrkgrp, smb_domain, wrkgrplen - 1); wrkgrp[wrkgrplen - 1] = 0;
        }
        strncpy(user, smb_user, userlen - 1); user[userlen - 1] = 0;
-       strncpy(passwd, smb_password, passwdlen - 1); passwd[passwdlen - 1] = 0;
+       if (smb_password != NULL) {
+               strncpy(passwd, smb_password, passwdlen - 1); passwd[passwdlen - 1] = 0;
+       }
 }
 
 static int smb_init(void)