lws_snprintf
authorAndy Green <andy@warmcat.com>
Wed, 14 Sep 2016 18:22:57 +0000 (02:22 +0800)
committerAndy Green <andy@warmcat.com>
Wed, 14 Sep 2016 18:22:57 +0000 (02:22 +0800)
commita496700b3a67ccb494385bfb22ebab0027af6e60
tree1dff9f60e1159c0af9e5da65979df294d149284b
parentc15714f35a0e059ae33c1959f4059967e04b71d2
lws_snprintf

Thanks to Fabrice Gilot for reporting the problem that led to uncovering this.

Due to a misunderstanding of the return value of snprintf (it is not truncated according
to the max size passed in) in several places relying on snprintf to truncate the length
overflows are possible.

This patch wraps snprintf with a new lws_snprintf() which does truncate its length to allow
the buffer limiting scheme to work properly.

All users should update with these fixes.
35 files changed:
doc/html/globals_func.html
doc/html/globals_l.html
doc/html/group__misc.html
doc/html/group__misc.js
doc/html/group__smtp.html
doc/html/libwebsockets_8h.html
doc/html/libwebsockets_8h.js
doc/html/libwebsockets_8h_source.html
doc/html/navtreedata.js
doc/html/navtreeindex0.js
doc/html/navtreeindex1.js
doc/html/navtreeindex2.js
doc/html/navtreeindex3.js
doc/html/navtreeindex4.js
lib/client-handshake.c
lib/lejp-conf.c
lib/libuv.c
lib/libwebsockets.c
lib/libwebsockets.h
lib/lws-plat-esp8266.c
lib/lws-plat-unix.c
lib/private-libwebsockets.h
lib/server.c
plugins/generic-sessions/handlers.c
plugins/generic-sessions/protocol_generic_sessions.c
plugins/generic-sessions/protocol_lws_messageboard.c
plugins/generic-sessions/utils.c
plugins/generic-table/protocol_table_dirlisting.c
plugins/protocol_dumb_increment.c
plugins/protocol_lws_status.c
plugins/protocol_post_demo.c
test-server/test-fraggle.c
test-server/test-ping.c
test-server/test-server-http.c
test-server/test-server-status.c