Blame SOURCES/0265-plugins-rhbz-Don-t-call-strlen-on-attachment-data.patch

28bab8
From 6e7c6e3dc51c370f78872e72584f746cfb5aa2fe Mon Sep 17 00:00:00 2001
28bab8
From: Ernestas Kulik <ekulik@redhat.com>
28bab8
Date: Wed, 29 May 2019 14:07:52 +0200
28bab8
Subject: [PATCH] =?UTF-8?q?plugins:=20rhbz:=20Don=E2=80=99t=20call=20strle?=
28bab8
 =?UTF-8?q?n()=20on=20attachment=20data?=
28bab8
MIME-Version: 1.0
28bab8
Content-Type: text/plain; charset=UTF-8
28bab8
Content-Transfer-Encoding: 8bit
28bab8
28bab8
It might not be textual, meaning that, if the blob somehow begins with
28bab8
NUL, it would be treated as empty.
28bab8
28bab8
Signed-off-by: Ernestas Kulik <ekulik@redhat.com>
28bab8
---
28bab8
 src/plugins/rhbz.c | 4 ++--
28bab8
 1 file changed, 2 insertions(+), 2 deletions(-)
28bab8
28bab8
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
28bab8
index a227c62..7708043 100644
28bab8
--- a/src/plugins/rhbz.c
28bab8
+++ b/src/plugins/rhbz.c
28bab8
@@ -657,7 +657,7 @@ int rhbz_attach_blob(struct abrt_xmlrpc *ax, const char *bug_id,
28bab8
 {
28bab8
     func_entry();
28bab8
 
28bab8
-    if (strlen(data) == 0)
28bab8
+    if (0 == data_len)
28bab8
     {
28bab8
         log_notice("not attaching an empty file: '%s'", filename);
28bab8
         /* Return SUCCESS */
28bab8
@@ -727,7 +727,7 @@ int rhbz_attach_fd(struct abrt_xmlrpc *ax, const char *bug_id,
28bab8
 
28bab8
 //TODO: need to have a method of attaching huge files (IOW: 1Gb read isn't good).
28bab8
 
28bab8
-    char *data = xmalloc(size + 1);
28bab8
+    char *data = xmalloc(size);
28bab8
     ssize_t r = full_read(fd, data, size);
28bab8
     if (r < 0)
28bab8
     {
28bab8
-- 
28bab8
2.21.0
28bab8