Whamcloud - gitweb
LU-14093 utils: fix format-overflow warning
authorDominique Martinet <asmadeus@codewreck.org>
Thu, 20 Jan 2022 00:25:07 +0000 (16:25 -0800)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 21 Jan 2022 23:17:14 +0000 (23:17 +0000)
commit8376613a73f3f32e712f50f5704fafa3c6895327
tree78f95b667f2a987b262f3062f901f168a31ee100
parentf032e2f4e82ebc8b6699769a113ec7f86d3ce1b6
LU-14093 utils: fix format-overflow warning

Fix the following warning on gcc11 by making numbuf big enough to fit
format content.

lfs.c: In function ‘print_quota’:
lfs.c:7719:48: error: ‘sprintf’ may write a terminating nul past the end of the destination [-Werror=format-overflow=]
 7719 |                         sprintf(numbuf[0], "%s*", strbuf);
      |                                                ^
lfs.c:7719:25: note: ‘sprintf’ output between 2 and 33 bytes into a destination of size 32
 7719 |                         sprintf(numbuf[0], "%s*", strbuf);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Test-parameters: trivial

Lustre-change: https://review.whamcloud.com/43711
Lustre-commit: a0fe9be254b944f5b005dd4b36c414827bcb40df

Change-Id: I021e6ffff2e1405eadbe689f718674af4d4d6376
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/46212
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/utils/lfs.c