Skip to content

Commit

Permalink
Fixing potential for out of bounds read_cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
armon committed Aug 31, 2012
1 parent 7ddcfde commit 62602c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/networking.c
Expand Up @@ -925,7 +925,9 @@ int extract_to_terminator(statsite_conn_info *conn, char terminator, char **buf,
*buf_len = term_addr - *buf + 1; // Difference between the terminator and location
*term_addr = '\0'; // Add a null terminator
*should_free = 0; // No need to free, in the buffer
conn->input.read_cursor = term_addr - conn->input.buffer + 1; // Push the read cursor forward

// Push the read cursor forward
conn->input.read_cursor = (term_addr - conn->input.buffer + 1) % conn->input.buf_size;
return 0;
}

Expand Down

0 comments on commit 62602c1

Please sign in to comment.