1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-15 09:44:04 +00:00

Fix segfault in mail folder (SF: 3007493)

This commit is contained in:
Nikolas Garofil 2010-06-02 19:22:44 +02:00
parent 6c750d09f2
commit a78d9538fc

View File

@ -61,6 +61,8 @@
#define POP3_TYPE 1
#define IMAP_TYPE 2
#define MAXFOLDERSIZE 128
struct mail_s { // for imap and pop3
unsigned long unseen;
unsigned long messages;
@ -74,7 +76,7 @@ struct mail_s { // for imap and pop3
char user[128];
char pass[128];
char command[1024];
char folder[128];
char folder[MAXFOLDERSIZE];
timed_thread *p_timed_thread;
char secure;
};
@ -465,17 +467,20 @@ struct mail_s *parse_mail_args(char type, const char *arg)
if (type == IMAP_TYPE) {
tmp = strstr(arg, "-f ");
if (tmp) {
int len = 1024;
int len = MAXFOLDERSIZE-1;
tmp += 3;
if (tmp[0] == '\'') {
len = strstr(tmp + 1, "'") - tmp - 1;
if (len > 1024) {
len = 1024;
if (len > MAXFOLDERSIZE-1) {
len = MAXFOLDERSIZE-1;
}
tmp++;
}
strncpy(mail->folder, tmp + 1, len);
strncpy(mail->folder, tmp, len);
mail->folder[len-1] = 0;
} else {
strncpy(mail->folder, "INBOX", 128); // default imap inbox
strncpy(mail->folder, "INBOX", MAXFOLDERSIZE-1); // default imap inbox
mail->folder[MAXFOLDERSIZE-1] = 0;
}
}
tmp = strstr(arg, "-e ");