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

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