From a8cf4a3b179974105bca3a354d6789120d961a1e 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. git-svn-id: https://srv7.svn-repos.de/dev34/pdclib/trunk@378 546481bc-9713-0410-bf18-d3337bbf4a3e --- 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.30.2