[Libreoffice-commits] .: desktop/unx

Stephan Bergmann sbergmann at kemper.freedesktop.org
Tue Nov 8 11:50:23 PST 2011


 desktop/unx/source/start.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit de90369c315afc62c4409a5df1a581fa466cb849
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Nov 8 20:49:07 2011 +0100

    Properly check sscanf return value.

diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c
index 9d95547..b30efdc 100644
--- a/desktop/unx/source/start.c
+++ b/desktop/unx/source/start.c
@@ -559,6 +559,7 @@ read_percent( ChildInfo *info, int *pPercent )
 
     char *pBegin;
     char *pIter;
+    char c;
 
     /* from the last call */
     int nNotProcessed = nRead - ( pNext - pBuffer );
@@ -598,7 +599,7 @@ read_percent( ChildInfo *info, int *pPercent )
         return ProgressExit;
     else if ( !strncasecmp( pBegin, "restart", 7 ) )
         return ProgressRestart;
-    else if ( sscanf( pBegin, "%d%%", pPercent ) )
+    else if ( sscanf( pBegin, "%d%c", pPercent, &c ) == 2 && c == '%' )
         return ProgressContinue;
 
     /* unexpected - let's exit the splash to be safe */


More information about the Libreoffice-commits mailing list