Skip to content

Commit

Permalink
Check ks buffer pointer overflow before dereferencing it. (signalwire…
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragos Oancea authored Mar 13, 2024
1 parent c4d9ba0 commit aa54525
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ks_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ KS_DECLARE(ks_size_t) ks_buffer_packet_count(ks_buffer_t *buffer)

e = (head + buffer->used);

for (p = head; p && *p && p < e; p++) {
for (p = head; p && p < e && *p; p++) {
if (*p == '\n') {
pe = p + 1;
if (*pe == '\r')
Expand All @@ -219,7 +219,7 @@ KS_DECLARE(ks_size_t) ks_buffer_read_packet(ks_buffer_t *buffer, void *data, ks_

e = (head + buffer->used);

for (p = head; p && *p && p < e; p++) {
for (p = head; p && p < e && *p; p++) {
if (*p == '\n') {
pe = p + 1;
if (*pe == '\r')
Expand Down

0 comments on commit aa54525

Please sign in to comment.