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

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