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)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 12 Mar 2021 12:47:13 +0000 (13:47 +0100)
commitee61fbab400241150c89f5d7370920db95a502c0
tree53a1862efe661a8a0b8cf7497844ff862066d18b
parent3c2e684aa77084c85d517328c011955864bed0d6
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>
(cherry picked from commit 598ec14ca797b61f25f183216323d533a7c45c5e)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 50e5b6ec5e0e5122e71f49c2f537f8e20dbeae9d)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/hlua_fcn.c