Whamcloud - gitweb
LU-14093 utils: fix DLSYM buffer over flow 38/43938/3
authorJames Simmons <jsimmons@infradead.org>
Mon, 7 Jun 2021 12:33:59 +0000 (08:33 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 21 Jun 2021 22:18:22 +0000 (22:18 +0000)
commit76bea6ca661609e3788d1cfe7e08e4a63af0a349
treef5d495562383385ba90246853623cac4e80a39f6
parent975b944b815412baef344f58a8325423b5d95e1e
LU-14093 utils: fix DLSYM buffer over flow

The 'name' string passed to DLSYM macro is created from the fsname
buffer in load_backfs_module(). That buffer is greater than 512
bytes in size but the temporary buffer in DLSYM is only 64. The
newest gcc version detect this bug.

mount_utils.c: In function ‘load_backfs_module’:
mount_utils.c:530:36: error: ‘%s’ directive output may be truncated writing up to 507 bytes into a region of size 64 [-Werror=format-truncation=]
  530 |   snprintf(_fname, sizeof(_fname), "%s_%s", prefix, #func); \
      |                                    ^~~~~~~
mount_utils.c:593:2: note: in expansion of macro ‘DLSYM’
  593 |  DLSYM(name, ops, init);

Change-Id: I8ae30a5288f236fb9272dffd40f44175e5e03ef9
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/43938
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/mount_utils.c