From e1aa1603e598277c4c0cb560ac068ac79c4dc2eb Mon Sep 17 00:00:00 2001 From: solar Date: Thu, 1 Oct 2009 05:44:07 +0000 Subject: [PATCH] Proper handling of NULL return code. --- functions/stdio/vfscanf.c | 5 +++++ functions/stdio/vsscanf.c | 5 +++++ 2 files changed, 10 insertions(+) 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; } -- 2.40.0