Permalink
Browse files

fix buffer overflow in opt_meth_setoption (#496)

  • Loading branch information...
QuanTech0 authored and jacob1 committed Sep 3, 2017
1 parent c34b54d commit 07e879e74c1b14d5ce082155e3274103aa5f1b09
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/lua/socket/options.c
@@ -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);
}

0 comments on commit 07e879e

Please sign in to comment.