Remove assertion and handle error cases

Fix #1633
This commit is contained in:
Davide Gessa 2016-06-06 20:17:29 +02:00
parent d2161e5c59
commit a525b3bd09

View file

@ -47,9 +47,12 @@ static void AddFiltersToDialog( GtkWidget *dialog, const char *filterList )
if ( NFDi_IsFilterSegmentChar(*p_filterList) ) if ( NFDi_IsFilterSegmentChar(*p_filterList) )
{ {
char typebufWildcard[NFD_MAX_STRLEN]; char typebufWildcard[NFD_MAX_STRLEN];
/* add another type to the filter */ /* add another type to the filter */
assert( strlen(typebuf) > 0 ); if (strlen(typebuf) <= 0 || strlen(typebuf) > NFD_MAX_STRLEN-1) {
assert( strlen(typebuf) < NFD_MAX_STRLEN-1 ); p_filterList++;
continue;
}
snprintf( typebufWildcard, NFD_MAX_STRLEN, "*.%s", typebuf ); snprintf( typebufWildcard, NFD_MAX_STRLEN, "*.%s", typebuf );
AddTypeToFilterName( typebuf, filterName, NFD_MAX_STRLEN ); AddTypeToFilterName( typebuf, filterName, NFD_MAX_STRLEN );