Skip to content

Commit

Permalink
fix buffer overflow in opt_meth_setoption (#496)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuanTech0 authored and jacob1 committed Sep 3, 2017
1 parent c34b54d commit 07e879e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lua/socket/options.c
Expand Up @@ -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"
Expand All @@ -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);
}
Expand Down

0 comments on commit 07e879e

Please sign in to comment.