Blame SOURCES/Avoid-uninitialized-free-when-allocating-buffers.patch

472fdf
From e660bc0594b6ddca143b460bb7edbbfba69f84ed Mon Sep 17 00:00:00 2001
472fdf
From: Robbie Harwood <rharwood@redhat.com>
472fdf
Date: Wed, 1 May 2019 11:27:13 -0400
472fdf
Subject: [PATCH] Avoid uninitialized free when allocating buffers
472fdf
472fdf
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
472fdf
Reviewed-by: Simo Sorce <simo@redhat.com>
472fdf
Resolves: #248
472fdf
(cherry picked from commit eafa3c9272c95646400123f8e4d6fb50cf36d36c)
472fdf
(cherry picked from commit e19466d172e0fd6d86b98b1423e9d99e0be30313)
472fdf
[rharwood@redhat.com: fuzz around padded]
472fdf
(cherry picked from commit abcc6cc90c6da5ea4fce65dd60e46b76767be557)
472fdf
[rharwood@redhat.com: more padded fuzz]
472fdf
---
472fdf
 proxy/src/gp_export.c | 3 ++-
472fdf
 1 file changed, 2 insertions(+), 1 deletion(-)
472fdf
472fdf
diff --git a/proxy/src/gp_export.c b/proxy/src/gp_export.c
472fdf
index dbfddeb..a5681c0 100644
472fdf
--- a/proxy/src/gp_export.c
472fdf
+++ b/proxy/src/gp_export.c
472fdf
@@ -300,6 +300,7 @@ static int gp_encrypt_buffer(krb5_context context, krb5_keyblock *key,
472fdf
                          &data_in,
472fdf
                          &enc_handle);
472fdf
     if (ret) {
472fdf
+        free(enc_handle.ciphertext.data);
472fdf
         ret = EINVAL;
472fdf
         goto done;
472fdf
     }
472fdf
@@ -308,12 +309,12 @@ static int gp_encrypt_buffer(krb5_context context, krb5_keyblock *key,
472fdf
                                enc_handle.ciphertext.data,
472fdf
                                out);
472fdf
     if (ret) {
472fdf
+        free(enc_handle.ciphertext.data);
472fdf
         goto done;
472fdf
     }
472fdf
 
472fdf
 done:
472fdf
     free(padded);
472fdf
-    free(enc_handle.ciphertext.data);
472fdf
     return ret;
472fdf
 }
472fdf