summaryrefslogtreecommitdiffstats
path: root/login-utils/last.c
diff options
context:
space:
mode:
authorRuediger Meier2017-06-11 22:20:24 +0200
committerKarel Zak2017-06-14 11:48:22 +0200
commitf64ddc95f39f2cb5cc5b41748754ecbe81cfa7dd (patch)
treeb1b34bdccf33999c8b5b27b9a7b823cad43ecedb /login-utils/last.c
parenthwclock: fix warning [-Winvalid-noreturn] (diff)
downloadkernel-qcow2-util-linux-f64ddc95f39f2cb5cc5b41748754ecbe81cfa7dd.tar.gz
kernel-qcow2-util-linux-f64ddc95f39f2cb5cc5b41748754ecbe81cfa7dd.tar.xz
kernel-qcow2-util-linux-f64ddc95f39f2cb5cc5b41748754ecbe81cfa7dd.zip
misc: fix gcc-7 sprintf warnings -Wformat-overflow
../login-utils/last.c: In function ‘main’: ../login-utils/last.c:624:23: warning: ‘%s’ directive writing up to 31 bytes into a region of size 27 [-Wformat-overflow=] sprintf(path, "/dev/%s", ut->ut_line); ^~ ~~ ../login-utils/last.c:624:3: note: ‘sprintf’ output between 6 and 37 bytes into a destination of size 32 sprintf(path, "/dev/%s", ut->ut_line); ../libblkid/src/devname.c: In function 'probe_one': ../libblkid/src/devname.c:166:29: warning: '%s' directive writing up to 255 bytes into a region of size 245 [-Wformat-overflow=] sprintf(path, "/sys/block/%s/slaves", de->d_name); ^~ ../libblkid/src/devname.c:166:3: note: 'sprintf' output between 19 and 274 bytes into a destination of size 256 sprintf(path, "/sys/block/%s/slaves", de->d_name); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'login-utils/last.c')
-rw-r--r--login-utils/last.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/login-utils/last.c b/login-utils/last.c
index f93ec7fbf..c90b574e5 100644
--- a/login-utils/last.c
+++ b/login-utils/last.c
@@ -598,7 +598,7 @@ static void __attribute__((__noreturn__)) usage(const struct last_control *ctl,
static int is_phantom(const struct last_control *ctl, struct utmpx *ut)
{
struct passwd *pw;
- char path[32];
+ char path[sizeof(ut->ut_line) + 16];
int ret = 0;
if (ut->ut_tv.tv_sec < ctl->boot_time.tv_sec)