BUG/MINOR: hlua: Don't strip last non-LWS char in hlua_pushstrippedstring()
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 3 Mar 2021 18:36:51 +0000 (19:36 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 5 Mar 2021 16:22:54 +0000 (17:22 +0100)
commit598ec14ca797b61f25f183216323d533a7c45c5e
treee266bb8a7daea342d3b2c6699cde3bf8fa6fb27d
parente788dfc3609ace6b9fba71698e39ef0b74696593
BUG/MINOR: hlua: Don't strip last non-LWS char in hlua_pushstrippedstring()

hlua_pushstrippedstring() function strips leading and trailing LWS
characters. But the result length it too short by 1 byte. Thus the last
non-LWS character is stripped. Note that a string containing only LWS
characters resulting to a stipped string with an invalid length (-1). This
leads to a lua runtime error.

This bug was reported in the issue #1155. It must be backported as far as
1.7.

(cherry picked from commit 2ec4e3c1acf95bcdc56028bbefe1a355c457b978)
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/hlua_fcn.c