[PATCH 1/6] sexp: fix invalid deallocation in error path

Peter Wu peter at lekensteyn.nl
Thu Jul 9 17:11:31 CEST 2015


* src/sexp.c: Fix wrong condition in error path.
--
This appears to be a copy and paste error and could result in wrong
memory being freed in the error path (when arrayisdesc[idx] == 2, the
condition ((!2) == 1) is false).

Signed-off-by: Peter Wu <peter at lekensteyn.nl>
---
 src/sexp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sexp.c b/src/sexp.c
index 9bc13ca..1c014e0 100644
--- a/src/sexp.c
+++ b/src/sexp.c
@@ -2405,7 +2405,7 @@ _gcry_sexp_vextract_param (gcry_sexp_t sexp, const char *path,
           _gcry_mpi_release (*array[idx]);
           *array[idx] = NULL;
         }
-      else if (!arrayisdesc[idx] == 1)
+      else if (arrayisdesc[idx] == 1)
         {
           /* Caller provided buffer.  */
           gcry_buffer_t *spec = (gcry_buffer_t*)array[idx];
-- 
2.4.4




More information about the Gcrypt-devel mailing list