Re: [sqwebmail] [PATCH] Forbid rename folder if new name contain dot
Brought to you by:
mrsam
From: Marcin S. <m.s...@ne...> - 2006-09-06 07:50:35
|
On Tue, Sep 05, 2006 at 08:04:06PM -0400, Sam Varshavchik wrote: > Marcin Semeniuk writes: > > >Hello Sam, > > > >I noticed that I can't create folder with dot in name, but I can change > >name to one with dot and webmail create tree of folders. I think it's > >inconsistency, so i made patch that forbid to rename folder if new name > >contain dot. > > When you see my version of this patch you'll slap yourself on the head, for > not seeing a much simpler fix. > You know courier sources better, anyway this looks simple to me (one simple check), rest of patch just do reformatting due whitespace changes. > As far as your other patch -- trimming off trailing colons in folder names > on the mail filtering screen -- again, you need to kick things up a notch. > For certain options, fieldname may be null, so you'll be freeing a NULL. > Oops. I was aware of that. According to "man 3 free" "void free(void *ptr);" "If ptr is NULL, no operation is performed." besides I assign to fieldname result of strdup of cgi("headername") cgi() always return string and strdup() always (ok, if there is enough memory) return new pointer. So You're right, there is some error when there will be no memory, strdup return NULL, and strlen(headername) will segfault, anyway i won't be freeing a NULL ;) > > I'll do that myself, and you'll have to test my fix yourself. You need to > be more careful in the future. I'll try to get into the habit of always checking if memory allocation failed. best regards, Marcin Semeniuk |