Skip to content

Fix -Wformat-security errors - #360

Merged
aloisklink merged 3 commits into
mainfrom
fix/fix-Wformat-security
Dec 9, 2022
Merged

Fix -Wformat-security errors#360
aloisklink merged 3 commits into
mainfrom
fix/fix-Wformat-security

Conversation

@aloisklink

Copy link
Copy Markdown
Contributor

Debian builds compile with -Wformat-security enabled.

This PR enables this flag, and fixes those errors.

See https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html for docs.

This caught a potential truncation bug in dnsmasq.c and a potential buffer overflow in sqlhook.c

This is mainly to make GCC happy when compiling under truncation
warning flags.
strncpy is not guaranteed to write a nul terminator.
Debian builds compile with -Wformat-security enabled.

See <https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html> for docs.
@aloisklink aloisklink added the bug Something isn't working label Dec 9, 2022
@aloisklink
aloisklink requested a review from mereacre December 9, 2022 13:36
@codecov

codecov Bot commented Dec 9, 2022

Copy link
Copy Markdown

Codecov Report

Merging #360 (3be9469) into main (431fff6) will increase coverage by 0.03%.
The diff coverage is 84.61%.

@@            Coverage Diff             @@
##             main     #360      +/-   ##
==========================================
+ Coverage   51.77%   51.80%   +0.03%     
==========================================
  Files         139      139              
  Lines       19313    19317       +4     
==========================================
+ Hits         9999    10008       +9     
+ Misses       9314     9309       -5     
Impacted Files Coverage Δ
src/sqlhook.c 0.00% <0.00%> (ø)
src/dhcp/dnsmasq.c 70.00% <100.00%> (+0.25%) ⬆️
tests/dhcp/test_dnsmasq.c 94.89% <100.00%> (+0.02%) ⬆️
src/ap/ap_service.c 50.85% <0.00%> (+3.42%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@mereacre mereacre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice.

@aloisklink
aloisklink merged commit b83e6f1 into main Dec 9, 2022
@aloisklink
aloisklink deleted the fix/fix-Wformat-security branch December 9, 2022 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants