Skip to content

fix potential buffer overflows - #719

Merged
kilograham merged 1 commit into
raspberrypi:developfrom
mjcross:fix-mqtt-client
Jun 18, 2026
Merged

kilograham merged 1 commit into
raspberrypi:developfrom
mjcross:fix-mqtt-client

Conversation

@mjcross

@mjcross mjcross commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

Replace two unsafe uses of strncpy() in the MQTT client example, which would return unterminated strings if an over-long topic string was truncated

Replace two unsafe uses of strncpy(): it doesn't terminate a string if it truncates it.
@peterharperuk

Copy link
Copy Markdown
Contributor

@kilograham Do you think it's safe for us to use strlcpy - I've not seen us use it much?

@kilograham

Copy link
Copy Markdown
Contributor

yes you can use strncpy

@kilograham kilograham added this to the 2.2.1 milestone Jun 18, 2026
@kilograham

Copy link
Copy Markdown
Contributor

ah you said strlcpy it seems fine on all c-libs ive tried, so i will merge for now

@kilograham
kilograham merged commit 9147089 into raspberrypi:develop Jun 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants