X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=filter.c;h=5fdec626f45954e0d364e085c1a9337db0641feb;hb=4d2aca39cdd96958b3f0bbc6973f15aac5133cdc;hp=9a18975faff485c6bdf25fe9cb67a7da746839a1;hpb=c4d2f4ab3d5166b75f8fc1bf9e2be776014d391d;p=pkg%2Fabook.git diff --git a/filter.c b/filter.c index 9a18975..5fdec62 100644 --- a/filter.c +++ b/filter.c @@ -140,7 +140,7 @@ get_real_name() pwent = getpwnam(username); - if( (tmp = (char *)malloc(strlen(pwent->pw_gecos) +1)) == NULL) + if((tmp = strdup(pwent->pw_gecos)) == NULL) return strdup(username); rtn = sscanf(pwent->pw_gecos, "%[^,]", tmp); @@ -640,15 +640,15 @@ mutt_read_line(FILE *in, char **alias, char **rest) while( ! ISSPACE(*ptr) ) ptr++; - if( (*alias = (char *)malloc(ptr-tmp+1)) == NULL) { + if( (*alias = (char *)malloc(ptr - tmp)) == NULL) { free(line); return 1; } - strncpy(*alias, tmp, ptr-tmp); + strncpy(*alias, tmp, ptr - tmp - 1); *(*alias + (ptr - tmp)) = 0; - while( ISSPACE(*ptr) ) + while(ISSPACE(*ptr)) ptr++; *rest = strdup(ptr);