Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Internal strlcpy underflows on zero buffer size #429

Closed
wferi opened this issue Dec 25, 2020 · 1 comment
Closed

Internal strlcpy underflows on zero buffer size #429

wferi opened this issue Dec 25, 2020 · 1 comment

Comments

@wferi
Copy link
Contributor

wferi commented Dec 25, 2020

The QB_MIN(maxlen-1, srclen) expression underflows for maxlen=0 because maxlen is unsigned, thus strlcpy(d,s,0) becomes strcpy(d,s) contrary to the function documentation. I don't think it affects the current code base, but probably worth fixing nevertheless to avoid future accidents.

chrissie-c added a commit to chrissie-c/libqb that referenced this issue Jan 4, 2021
chrissie-c added a commit that referenced this issue Jan 13, 2021
* strlcpy: Check for maxlen underflow

#429

* Always terminate the string if maxlen is > 0
@chrissie-c
Copy link
Contributor

Fixed in 5097155

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants