summaryrefslogtreecommitdiffstats
path: root/src/openvpn/buffer.h
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2015-07-27 17:33:11 +0200
committerGert Doering <gert@greenie.muc.de>2015-07-27 20:21:25 +0200
commitd40cbf0e2601b35bfb1c0551c6f3907b5c5178ff (patch)
treeae91fd4119372e499b0d1281d0319fb96be007ab /src/openvpn/buffer.h
parent2dd6501e3d679046a1ed488f22d62defdf737cf3 (diff)
downloadopenvpn-d40cbf0e2601b35bfb1c0551c6f3907b5c5178ff.tar.gz
openvpn-d40cbf0e2601b35bfb1c0551c6f3907b5c5178ff.tar.xz
openvpn-d40cbf0e2601b35bfb1c0551c6f3907b5c5178ff.zip
Fix commit e473b7c if an inline file happens to have a line break exactly at buffer limit
The check does only for strlen(line) space and buf_printf will only use at most space -1 and not print the final character ('\n') in this corner. Since a missing \n only breaks certificates at the start and end marker, missing line breaks otherwise do not trigger this error. Acked-by: Steffan Karger <steffan.karger@fox-it.com> Message-Id: <1438011191-19389-1-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/9956 Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src/openvpn/buffer.h')
-rw-r--r--src/openvpn/buffer.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/openvpn/buffer.h b/src/openvpn/buffer.h
index 5695f64..0dc511b 100644
--- a/src/openvpn/buffer.h
+++ b/src/openvpn/buffer.h
@@ -329,7 +329,10 @@ has_digit (const unsigned char* src)
}
/*
- * printf append to a buffer with overflow check
+ * printf append to a buffer with overflow check,
+ * due to usage of vsnprintf, it will leave space for
+ * a final null character and thus use only
+ * capacity - 1
*/
bool buf_printf (struct buffer *buf, const char *format, ...)
#ifdef __GNUC__