From: solar Date: Thu, 1 Oct 2009 05:44:07 +0000 (+0000) Subject: Proper handling of NULL return code. X-Git-Tag: v0.5~114 X-Git-Url: https://pd.if.org/git/?p=pdclib;a=commitdiff_plain;h=e1aa1603e598277c4c0cb560ac068ac79c4dc2eb Proper handling of NULL return code. --- diff --git a/functions/stdio/vfscanf.c b/functions/stdio/vfscanf.c index eda4226..0667c99 100644 --- a/functions/stdio/vfscanf.c +++ b/functions/stdio/vfscanf.c @@ -59,6 +59,11 @@ int vfscanf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict forma } else { + /* NULL return code indicates matching error */ + if ( rc == NULL ) + { + break; + } /* Continue parsing after conversion specifier */ format = rc; } diff --git a/functions/stdio/vsscanf.c b/functions/stdio/vsscanf.c index 34397ac..f33b8c4 100644 --- a/functions/stdio/vsscanf.c +++ b/functions/stdio/vsscanf.c @@ -59,6 +59,11 @@ int vsscanf( const char * _PDCLIB_restrict s, const char * _PDCLIB_restrict form } else { + /* NULL return code indicates matching error */ + if ( rc == NULL ) + { + break; + } /* Continue parsing after conversion specifier */ format = rc; }