From: Christophe CURIS <[email protected]>

As pointed by Coverity, the return value of 'sscanf' is not checked, which
may not be a problem because the fall-back value for 'i' is provided before.

However, if sscanf fails there is no guarantee that all implementation would
leave 'i' untouched in case of parsing error, and for convenience it is more
logical to write the code is such a way that the value assignment looks like
the fall-back value it is.

Signed-off-by: Christophe CURIS <[email protected]>
---
 WPrefs.app/TexturePanel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/WPrefs.app/TexturePanel.c b/WPrefs.app/TexturePanel.c
index 9f2b86a..58e9ecc 100644
--- a/WPrefs.app/TexturePanel.c
+++ b/WPrefs.app/TexturePanel.c
@@ -824,8 +824,8 @@ void SetTexturePanelTexture(TexturePanel * panel, const 
char *name, WMPropList *
                        wfree(panel->imageFile);
                panel->imageFile = 
wstrdup(WMGetFromPLString(WMGetFromPLArray(texture, 1)));
 
-               i = 180;
-               sscanf(WMGetFromPLString(WMGetFromPLArray(texture, 2)), "%i", 
&i);
+               if (sscanf(WMGetFromPLString(WMGetFromPLArray(texture, 2)), 
"%i", &i) != 1)
+                       i = 180;
                WMSetSliderValue(panel->topaS, i);
 
                p = WMGetFromPLArray(texture, 3);
-- 
1.9.2


-- 
To unsubscribe, send mail to [email protected].

Reply via email to