mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-03-22 23:29:54 +01:00
fix buffer overflow in opt_meth_setoption (#496)
This commit is contained in:
parent
c34b54d974
commit
07e879e74c
@ -5,6 +5,7 @@
|
||||
* RCS ID: $Id: options.c,v 1.6 2005/11/20 07:20:23 diego Exp $
|
||||
\*=========================================================================*/
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "auxiliar.h"
|
||||
#include "options.h"
|
||||
@ -31,9 +32,10 @@ int opt_meth_setoption(lua_State *L, p_opt opt, p_socket ps)
|
||||
while (opt->name && strcmp(name, opt->name))
|
||||
opt++;
|
||||
if (!opt->func) {
|
||||
char msg[45];
|
||||
char* msg = malloc(30+strlen(name));
|
||||
sprintf(msg, "unsupported option `%.35s'", name);
|
||||
luaL_argerror(L, 2, msg);
|
||||
free(msg);
|
||||
}
|
||||
return opt->func(L, ps);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user