libestr/0009-Don-t-pass-NULL-to-memcpy.patch
2019-09-30 10:55:55 -04:00

27 lines
693 B
Diff

From 587ff26d15e807c3a50c5c83e0b8a4bb0f9e5e51 Mon Sep 17 00:00:00 2001
From: Tomas Heinrich <theinric@redhat.com>
Date: Fri, 30 May 2014 12:10:36 +0200
Subject: [PATCH 09/30] Don't pass NULL to memcpy
This was benign as NULL ptr implied 0 length.
---
src/string.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/string.c b/src/string.c
index 2930868..8934553 100644
--- a/src/string.c
+++ b/src/string.c
@@ -528,7 +528,7 @@ es_str2cstr(es_str_t *s, char *nulEsc)
if(c[i] == 0x00) {
if(lenEsc == 1) {
cstr[iDst++] = *nulEsc;
- } else {
+ } else if(lenEsc > 1) {
memcpy(cstr + iDst, nulEsc, lenEsc);
iDst += lenEsc;
}
--
1.8.3.1