# HG changeset patch # User reimar # Date 1277485000 0 # Node ID 0a7222a42a7001f9e3aec53e8c284a49cd968c30 # Parent e4d6cf87aa06dffd796b153b63cb1c653bd88e24 Ensure that e.g. -af-pre will not cause the filter list to be unterminated when the list was empty before. Should fix bug #1687. diff -r e4d6cf87aa06 -r 0a7222a42a70 m_option.c --- a/m_option.c Fri Jun 25 16:53:27 2010 +0000 +++ b/m_option.c Fri Jun 25 16:56:40 2010 +0000 @@ -485,10 +485,12 @@ lst = realloc(lst,(n+ln+1)*sizeof(char*)); if(pre) { - memmove(&lst[n],lst,(ln+1)*sizeof(char*)); + memmove(&lst[n],lst,ln*sizeof(char*)); memcpy(lst,add,n*sizeof(char*)); } else - memcpy(&lst[ln],add,(n+1)*sizeof(char*)); + memcpy(&lst[ln],add,n*sizeof(char*)); + // (re-)add NULL-termination + lst[ln+n] = NULL; free(add);