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

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