Blob Blame History Raw
From d10e9b9e9b3118405ac701ce9109bc7239ff1752 Mon Sep 17 00:00:00 2001
From: Ernestas Kulik <ekulik@redhat.com>
Date: Wed, 29 May 2019 14:07:52 +0200
Subject: [PATCH] =?UTF-8?q?plugins:=20rhbz:=20Don=E2=80=99t=20call=20strle?=
 =?UTF-8?q?n()=20on=20attachment=20data?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

It might not be textual, meaning that, if the blob somehow begins with
NUL, it would be treated as empty.

Signed-off-by: Ernestas Kulik <ekulik@redhat.com>
---
 src/plugins/rhbz.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index 680527d7..96b6d7da 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -611,7 +611,7 @@ int rhbz_attach_blob(struct abrt_xmlrpc *ax, const char *bug_id,
 {
     func_entry();
 
-    if (strlen(data) == 0)
+    if (0 == data_len)
     {
         log_notice("not attaching an empty file: '%s'", filename);
         /* Return SUCCESS */
@@ -681,7 +681,7 @@ int rhbz_attach_fd(struct abrt_xmlrpc *ax, const char *bug_id,
 
 //TODO: need to have a method of attaching huge files (IOW: 1Gb read isn't good).
 
-    char *data = xmalloc(size + 1);
+    char *data = xmalloc(size);
     ssize_t r = full_read(fd, data, size);
     if (r < 0)
     {
-- 
2.21.0