[gcab] Always check the return value when writing to the stream



commit ccbfeaf7b96431a4f2e290a0a2c3db374b9bb155
Author: Richard Hughes <richard hughsie com>
Date:   Wed Mar 1 16:40:05 2017 +0000

    Always check the return value when writing to the stream
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779462

 libgcab/cabinet.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/libgcab/cabinet.c b/libgcab/cabinet.c
index 4df9024..a675d1b 100644
--- a/libgcab/cabinet.c
+++ b/libgcab/cabinet.c
@@ -190,9 +190,10 @@ cheader_write (cheader_t *ch, GDataOutputStream *out,
         return FALSE;
 
     if (ch->flags & CABINET_HEADER_RESERVE) {
-        W2 (ch->res_header);
-        W1 (ch->res_folder);
-        W1 (ch->res_data);
+        if (!W2 (ch->res_header) ||
+            !W1 (ch->res_folder) ||
+            !W1 (ch->res_data))
+                return FALSE;
         if (g_output_stream_write (stream, ch->reserved, ch->res_header,
                                    cancellable, error) == -1)
             return FALSE;


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