--- parser3/src/main/pa_common.C 2002/02/07 17:41:36 1.99 +++ parser3/src/main/pa_common.C 2002/02/13 11:59:29 1.103 @@ -1,10 +1,10 @@ /** @file Parser: commonly functions. - Copyright(c) 2001 ArtLebedev Group(http://www.artlebedev.com) - Author: Alexander Petrosyan (http://paf.design.ru) + Copyright(c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexandr Petrosian (http://paf.design.ru) - $Id: pa_common.C,v 1.99 2002/02/07 17:41:36 paf Exp $ + $Id: pa_common.C,v 1.103 2002/02/13 11:59:29 paf Exp $ */ #include "pa_common.h" @@ -78,6 +78,10 @@ static int unlock(int fd) { FLOCK(F_TLOC #endif static char *strnchr(char *buf, size_t size, char c) { + // sanity check + if(!buf) + return 0; + for(; size-->0; buf++) { if(*buf==c) return buf;