Skip to content
Permalink
Browse files Browse the repository at this point in the history
Security fix: prevents empty host from being used
  • Loading branch information
simonemainardi committed Feb 13, 2017
1 parent 97515fd commit 01f47e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Lua.cpp
Expand Up @@ -6018,7 +6018,8 @@ void Lua::setParamsTable(lua_State* vm, const char* table_name,
char *_equal;

if(strncmp(tok, "csrf", strlen("csrf")) /* Do not put csrf into the params table */
&& (_equal = strchr(tok, '='))) {
&& (_equal = strchr(tok, '='))
&& (strlen(_equal) > 1)) {

This comment has been minimized.

Copy link
@emanuele-f

emanuele-f Feb 14, 2017

Contributor

@simonemainardi this cuts off some valid empty parameters, like "custom_name"

This comment has been minimized.

Copy link
@simonemainardi

simonemainardi Feb 14, 2017

Author Contributor

with this I am no longer allowing empty-string parameters. If you want to release this extra check, please double check for other possible NULL pointer dereferencing as in line 2203 below

char *decoded_buf;
int len;

Expand Down
2 changes: 2 additions & 0 deletions src/NetworkInterface.cpp
Expand Up @@ -2200,6 +2200,8 @@ Host* NetworkInterface::getHost(char *host_ip, u_int16_t vlan_id) {
struct in6_addr a6;
Host *h = NULL;

if(!host_ip) return(NULL);

/* Check if address is invalid */
if((inet_pton(AF_INET, (const char*)host_ip, &a4) == 0)
&& (inet_pton(AF_INET6, (const char*)host_ip, &a6) == 0)) {
Expand Down

0 comments on commit 01f47e0

Please sign in to comment.