Skip to content

Conversation

@orgads
Copy link
Contributor

@orgads orgads commented Sep 8, 2024

In the given example, there is an invalid field:

To: sut <sip:[service]@[remote_ip]:"remote_port]>

There are no more quotes later. When we search for the terminating quote, nothing is found, so we skip to the end of the string. Then the loop continues, we have p++ and continue beyond the buffer.

Fixes #727.

@orgads
Copy link
Contributor Author

orgads commented Sep 8, 2024

@wdoekes should we also include \n in strcspn?

In the given example, there is an invalid field:
To: sut <sip:[service]@[remote_ip]:"remote_port]>

There are no more quotes later. When we search for the terminating
quote, nothing is found, so we skip to the end of the string. Then
the loop continues, we have p++ and continue beyond the buffer.

Fixes SIPp#727.
if (*p == '"') {
p++;
p += strcspn(p, "\"");
p += strcspn(p, "\"\n");

Check notice

Code scanning / CodeQL

For loop variable changed in body

Loop counters should not be modified in the body of the [loop](1).
@orgads orgads merged commit 6154ab1 into SIPp:master Sep 10, 2024
@orgads orgads deleted the fuzz-quote branch September 10, 2024 12:52
@orgads orgads added the bug label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SECURITY] heap-buffer-overflow in message.cpp

1 participant