mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
BUG/MINOR: lua: ensure large proxy IDs can be represented
In function hlua_fcn_new_proxy() too small a buffer was passed to snprintf(), resulting in large proxy or listener IDs to make snprintf() fail. It is unlikely to meet this case but let's fix it anyway. This fix must be backported to all stable branches where it applies.
This commit is contained in:
parent
706d5ee0c3
commit
29d698040d
@ -838,7 +838,7 @@ int hlua_fcn_new_proxy(lua_State *L, struct proxy *px)
|
|||||||
struct server *srv;
|
struct server *srv;
|
||||||
struct listener *lst;
|
struct listener *lst;
|
||||||
int lid;
|
int lid;
|
||||||
char buffer[10];
|
char buffer[17];
|
||||||
|
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
|
||||||
@ -878,7 +878,7 @@ int hlua_fcn_new_proxy(lua_State *L, struct proxy *px)
|
|||||||
if (lst->name)
|
if (lst->name)
|
||||||
lua_pushstring(L, lst->name);
|
lua_pushstring(L, lst->name);
|
||||||
else {
|
else {
|
||||||
snprintf(buffer, 10, "sock-%d", lid);
|
snprintf(buffer, sizeof(buffer), "sock-%d", lid);
|
||||||
lid++;
|
lid++;
|
||||||
lua_pushstring(L, buffer);
|
lua_pushstring(L, buffer);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user