libestr/0021-bugfix-es_str2num-mishandling-empty-strings.patch
2019-09-30 10:55:55 -04:00

34 lines
825 B
Diff

From a5729d4f286ebb1344c97b8c768d728392801f44 Mon Sep 17 00:00:00 2001
From: Jan Gerhards <jgerhards@adiscon.com>
Date: Mon, 13 Feb 2017 12:20:19 +0100
Subject: [PATCH 21/30] bugfix: es_str2num mishandling empty strings
If es_str2num() receives an empty string, misadressing happens.
Under extreme conditions, this theoretically can lead to a segfault.
closes https://github.com/rsyslog/libestr/issues/10
---
src/string.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/string.c b/src/string.c
index f703925..6d06713 100644
--- a/src/string.c
+++ b/src/string.c
@@ -607,10 +607,10 @@ es_str2num(es_str_t *s, int *bSuccess)
{
long long num;
unsigned char *c;
-
if(s->lenStr == 0) {
num = 0;
- *bSuccess = 0;
+ if(bSuccess != NULL)
+ *bSuccess = 0;
goto done;
}
--
1.8.3.1