Skip to content

Commit 1639ec8

Browse files
fix: check on wrong return value in addr_init
`addr_init` calls `inet_pton`, which returns 0 when the supplied does string does not represent a valid network address in the specified address family. We were checking for -1 instead of 0, missing this error case. Due to that error, the sensor accepts any value in the socket output configuration, even invalid ip address, and blocks instead of reporting an error. git reset --soft HEAD~1
1 parent 7d73506 commit 1639ec8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/storage_socket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ socket_initialize(struct storage_module *module)
9898
if (module->is_initialized)
9999
return -1;
100100

101-
if(addr_init(ctx->config, &(ctx->address)) == -1){
101+
if(addr_init(ctx->config, &(ctx->address)) == 0){
102102
zsys_error("socket: failed to parse uri: %s", ctx->config.address);
103103
goto error;
104104
}

0 commit comments

Comments
 (0)