Blob Blame History Raw
From 1a7533244a1e158ee071e821bbb05cb31c16d25e Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Sun, 28 Oct 2018 01:33:23 +0200
Subject: [PATCH] voutf: fix bad arethmetic when outputting warnings to stderr

CVE-2018-16842
Reported-by: Brian Carpenter
Bug: https://curl.haxx.se/docs/CVE-2018-16842.html

Upstream-commit: d530e92f59ae9bb2d47066c3c460b25d2ffeb211
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
 src/tool_msgs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/tool_msgs.c b/src/tool_msgs.c
index 80fdf4e..ce47e9a 100644
--- a/src/tool_msgs.c
+++ b/src/tool_msgs.c
@@ -67,8 +67,8 @@ void warnf(struct Configurable *config, const char *fmt, ...)
 
         (void)fwrite(ptr, cut + 1, 1, config->errors);
         fputs("\n", config->errors);
-        ptr += cut+1; /* skip the space too */
-        len -= cut;
+        ptr += cut + 1; /* skip the space too */
+        len -= cut + 1;
       }
       else {
         fputs(ptr, config->errors);
-- 
2.17.2