[tracker-miners/wip/carlosg/coverity-fixes: 17/28] tracker-extract: Strengthen condition in epub extractor




commit 713684910ba5c87b760e168ff776a88192b07cdf
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Oct 24 11:09:53 2021 +0200

    tracker-extract: Strengthen condition in epub extractor
    
    Coverity seems to think we can fill the fname variable both within
    the loop (after finding a comma) and still be able to fall through
    the i == len condition. This is not true, but make this condition
    stronger by also checking that fname is still empty.
    
    CID: #365674

 src/tracker-extract/tracker-extract-epub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/tracker-extract/tracker-extract-epub.c b/src/tracker-extract/tracker-extract-epub.c
index 0e4af5b16..a6bcdcba6 100644
--- a/src/tracker-extract/tracker-extract-epub.c
+++ b/src/tracker-extract/tracker-extract-epub.c
@@ -318,7 +318,7 @@ opf_xml_text_handler (GMarkupParseContext   *context,
                                }
                        }
 
-                       if (i == len) {
+                       if (!fname && i == len) {
                                fname = g_strdup (data->savedstring);
                                g_debug ("Found only one name");
                        } else {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]