[Home]

Summary:ASTERISK-08187: IMAP storage in trunk truncates username and password to 3 chars
Reporter:slimey (slimey)Labels:
Date Opened:2006-11-25 16:11:22.000-0600Date Closed:2006-11-29 15:07:47.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_voicemail
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:In revision 47278, function mm_login in app_voicemail.c was modified, and replaced calls to strcpy() with ast_copy_string().

Function prototype is:
void mm_login(NETMBX * mb, char *user, char *pwd, long trial)

ast_copy_string() is called thus:
ast_copy_string(user, mb->user, sizeof(user));

Because user is a char*, sizeof returns 4 (the size of a pointer for me), and so only 3 characters are copied.

Sorry, don't know how best to fix this, but putting a large enough static number in there allows IMAP login to work for me.
Comments:By: slimey (slimey) 2006-11-28 08:15:01.000-0600

I've had a poke through imap-2006c1 code, and it statically allocates MAILTMPLEN bytes for both user and password.

c-client/mail.h:#define MAILTMPLEN 1024         /* size of a temporary buffer */

So we should be safe to pass either MAILTMPLEN or 1024 to ast_copy_string

How best to continue? At the moment, IMAP is totally broken.

By: Joshua C. Colp (jcolp) 2006-11-28 23:02:35.000-0600

Can you grab me on IRC tomorrow? I'd like to talk about this... and getting the IMAP stuff setup and what obstacles you overcame.

By: Joshua C. Colp (jcolp) 2006-11-29 15:07:47.000-0600

Fixed in 1.4 as of revision 48115 and trunk as of revision 48116. Thanks!