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