SASL doesn't free the sasl_secret_t, so this was leaking. Instead,
keep our own pointer to it, and safe_realloc() each time.
sasl_secret_t doesn't need the data field null terminated, so memcpy
the password over.
static sasl_callback_t mutt_sasl_callbacks[5];
+static sasl_secret_t *secret_ptr = NULL;
+
static int mutt_sasl_start (void);
/* callbacks */
len = strlen (account->pass);
- *psecret = (sasl_secret_t*) safe_malloc (sizeof (sasl_secret_t) + len);
- (*psecret)->len = len;
- strcpy ((char*)(*psecret)->data, account->pass); /* __STRCPY_CHECKED__ */
+ safe_realloc (&secret_ptr, sizeof (sasl_secret_t) + len);
+ memcpy ((char *) secret_ptr->data, account->pass, (size_t) len);
+ secret_ptr->len = len;
+ *psecret = secret_ptr;
return SASL_OK;
}