Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

db: avoid -Werror=format-truncation with GCC >= 7 #415

Merged

Conversation

diabonas
Copy link
Member

Since commit 548c65c GCC >= 7 produces several warnings of the form

src/lib/db.c: In function ‘db_new.constprop’:
src/lib/db.c:1504:37: error: ‘%s’ directive output may be truncated writing 5 bytes into a region of size between 1 and 4096 [-Werror=format-truncation=]
 1504 |     snprintf(lockpath, PATH_MAX, "%s%s", path, ".lock");
      |                                     ^~         ~~~~~~~

Since commit 548c65c GCC >= 7 produces
several warnings of the form

src/lib/db.c: In function ‘db_new.constprop’:
src/lib/db.c:1504:37: error: ‘%s’ directive output may be truncated writing 5 bytes into a region of size between 1 and 4096 [-Werror=format-truncation=]
 1504 |     snprintf(lockpath, PATH_MAX, "%s%s", path, ".lock");
      |                                     ^~         ~~~~~~~

Signed-off-by: Jonas Witschel <diabonas@gmx.de>
@codecov
Copy link

codecov bot commented Feb 21, 2020

Codecov Report

Merging #415 into master will decrease coverage by 0.08%.
The diff coverage is 47.05%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #415      +/-   ##
==========================================
- Coverage   72.27%   72.19%   -0.09%     
==========================================
  Files          30       30              
  Lines        6446     6459      +13     
==========================================
+ Hits         4659     4663       +4     
- Misses       1787     1796       +9
Impacted Files Coverage Δ
src/lib/db.c 64.42% <47.05%> (-0.55%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 17909e2...aa6f33c. Read the comment docs.

@diabonas diabonas mentioned this pull request Feb 22, 2020
@williamcroberts williamcroberts merged commit 8d06114 into tpm2-software:master Feb 24, 2020
@diabonas diabonas deleted the fix-werror-format-truncation branch February 24, 2020 18:58
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.

2 participants