[dev] segfault in basename

1 view
Skip to first unread message

Frank Busse

unread,
Oct 23, 2025, 5:47:34 AMOct 23
to d...@suckless.org
Hi,


I ran sbase with klovo.io's KLEE extension and it reported a write to
read-only memory:

Asan confirms for revision 9aeab2a47c:
---
/basename "" ""
AddressSanitizer:DEADLYSIGNAL
=================================================================
==176910==ERROR: AddressSanitizer: SEGV on unknown address
==176910==The signal is caused by a WRITE memory access.
..
---


Best,

Frank

Carlos Torres

unread,
Nov 4, 2025, 8:35:21 AMNov 4
to dev mail list
On Thu, Oct 23, 2025 at 5:49 AM Frank Busse <f.b...@imperial.ac.uk> wrote:
> ---
> /basename "" ""
>

Thanks Frank,

to compile sbase with gcc asan one can edit config.mk
CFLAGS = -fsanitize=address -g
LDFLAGS = -lasan

this bug comes along between basename.c:29-32 because suffix strlen
should always be greater than 0 and less than strlen of path

BTW... i can do better with my patch and message. please ignore that one.

--Carlos

Reply all
Reply to author
Forward
0 new messages