Skip to content

Commit

Permalink
Add strlen() sanity check to mbrtowc() call. Thanks to jmcg
Browse files Browse the repository at this point in the history
  • Loading branch information
jkaluza committed Sep 5, 2011
1 parent a048bba commit e1c2065
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion config.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ static char *readPath(const char *configFile, int lineNum, char *key,

chptr = start;

while( (len = mbrtowc(&pwc, chptr, strlen(chptr), NULL)) != 0 ) {
while( (len = mbrtowc(&pwc, chptr, strlen(chptr), NULL)) != 0 && strlen(chptr) != 0) {
if( len == (size_t)(-1) || len == (size_t)(-2) || !iswprint(pwc) || iswblank(pwc) ) {
message(MESS_ERROR, "%s:%d bad %s path %s\n",
configFile, lineNum, key, start);
Expand Down

0 comments on commit e1c2065

Please sign in to comment.