Skip to content

Commit

Permalink
pool: fix user_agent alloc.
Browse files Browse the repository at this point in the history
  • Loading branch information
nodech committed Dec 16, 2021
1 parent d2bb5f4 commit 5af0156
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ hsk_pool_init(hsk_pool_t *pool, const uv_loop_t *loop) {
pool->pending_count = 0;
pool->block_time = 0;
pool->getheaders_time = 0;
pool->user_agent = (char *)malloc(255);
pool->user_agent = (char *)malloc(256);
strcpy(pool->user_agent, HSK_USER_AGENT);

return HSK_SUCCESS;
Expand Down Expand Up @@ -302,7 +302,7 @@ hsk_pool_set_agent(hsk_pool_t *pool, const char *user_agent) {
if (!user_agent)
return true;

size_t len = strlen(pool->user_agent);
size_t len = strlen(pool->user_agent);
len += strlen(user_agent);

// Agent size in p2p version message is 1 byte
Expand Down

0 comments on commit 5af0156

Please sign in to comment.