From: Sascha Schumann Date: Fri, 3 Aug 2001 09:36:14 +0000 (+0000) Subject: Fix a possible segfault (Thanks to Sebastian for catching it) X-Git-Tag: PRE_ENGINE2_SPLIT~103 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=84aed3b718817b8e90328e38bd5d2fc5847ba365;p=php Fix a possible segfault (Thanks to Sebastian for catching it) --- diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index 8e3eac0828..f9182be613 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -89,9 +89,16 @@ extern int le_fp; efree(key); \ } -#define SEARCHCR() do { \ - for (p = READPTR(sock), pe = p + MIN(TOREAD(sock), maxlen); \ - *p != '\n'; ) if (++p >= pe) { p = NULL; break; } \ +#define SEARCHCR() do { \ + if (TOREAD(sock)) { \ + for (p = READPTR(sock), pe = p + MIN(TOREAD(sock), maxlen); \ + *p != '\n'; ) \ + if (++p >= pe) { \ + p = NULL; \ + break; \ + } \ + } else \ + p = NULL; \ } while (0) #ifdef PHP_WIN32