Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

OOB read in bencode_decode: strtoll called on non-NUL-terminated buffer

Closed Beginner friendly
#2,199 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
67/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c
Domain
security

Research direction

Start in lib/bencode.c at __bencode_decode_integer around line 448, then read how bencode_decode_expect receives the buffer from ng_client.c around line 176. Check how the integer parser handles the input length and NUL termination. Done means malformed input such as i is rejected without reading past the buffer, while valid integers still decode.

Written by the indexing model from the issue text.

Description

__bencode_decode_integer (lib/bencode.c:448) calls strtoll(s, &convend, 10) on the length-delimited input buffer. strtoll requires NUL termination but bencode buffers are not NUL-terminated.

When the integer payload begins with whitespace (e.g. i , hex 69 20), strtoll skips it and scans past the buffer boundary looking for digits, causing a heap-buffer-overflow read.

Reachable from: ng_client.c receives into a 4096-byte arena buffer (arena_alloc, no NUL terminator) and passes it to bencode_decode_expect at line 176. A remote NG peer response with a valid cookie and malformed bencode body triggers the read.

Impact: Out-of-bounds read, process crash (DoS). No write primitive.

Fix: Copy the integer text into a stack buffer with NUL termination before calling strtoll, or bound the scan manually without strtoll.

Reproduce:

# 2-byte payload: "i " (0x69 0x20)
echo -n "i " | base64
# aSA=

Found by Bright Security using automated fuzz testing.

Dominant language
Perl
Stars
992
Forks
459
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sipwise/rtpengine

All issues in sipwise/rtpengine

Similar issues

More Perl issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.