Skip to content

Commit

Permalink
stratum: more string params checks
Browse files Browse the repository at this point in the history
  • Loading branch information
tpruvot committed Jun 3, 2018
1 parent ba20dc3 commit 411a6c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stratum/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ bool client_authorize(YAAMP_CLIENT *client, json_value *json_params)
return false;
}

if(json_params->u.array.length>1)
if(json_params->u.array.length>1 && json_params->u.array.values[1]->u.string.ptr)
strncpy(client->password, json_params->u.array.values[1]->u.string.ptr, 1023);

if (g_list_client.count >= g_stratum_max_cons) {
client_send_error(client, 21, "Server full");
return false;
}

if(json_params->u.array.length>0)
if(json_params->u.array.length>0 && json_params->u.array.values[0]->u.string.ptr)
{
strncpy(client->username, json_params->u.array.values[0]->u.string.ptr, 1023);

Expand Down

0 comments on commit 411a6c7

Please sign in to comment.