Use p_new instead of xmalloc()
[apps/madmutt.git] / mutt_sasl.c
index 374082b..e32af34 100644 (file)
@@ -186,8 +186,8 @@ int mutt_sasl_client_new (CONNECTION * conn, sasl_conn_t ** saslconn)
 
 int mutt_sasl_interact (sasl_interact_t * interaction)
 {
-    char prompt[SHORT_STRING];
-    char resp[SHORT_STRING];
+    char prompt[STRING];
+    char resp[STRING];
 
     while (interaction->id != SASL_CB_LIST_END) {
         snprintf (prompt, sizeof (prompt), "%s: ", interaction->prompt);
@@ -285,7 +285,8 @@ static int mutt_sasl_cb_authname (void *context, int id, const char **result,
     return SASL_OK;
 }
 
-static int mutt_sasl_cb_pass(sasl_conn_t *conn, void *context, int id,
+static int mutt_sasl_cb_pass(sasl_conn_t *conn __attribute__ ((unused)),
+                             void *context, int id __attribute__ ((unused)),
                              sasl_secret_t **psecret)
 {
     ACCOUNT *account = (ACCOUNT *) context;
@@ -301,7 +302,7 @@ static int mutt_sasl_cb_pass(sasl_conn_t *conn, void *context, int id,
 
     *psecret = xmalloc(sizeof(sasl_secret_t) + len);
     (*psecret)->len = len;
-    strcpy((char*)(*psecret)->data, account->pass);
+    memcpy((char*)(*psecret)->data, account->pass, len);
 
     return SASL_OK;
 }