diff options
author | Mattias Andrée <maandree@kth.se> | 2023-06-23 12:09:07 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2023-06-23 12:09:07 +0200 |
commit | 35f093ab7b01bcabbbef8b517945fa0f32950199 (patch) | |
tree | fefdb02e6588b79a2540589e00d4739e1f4f91a7 /key2root-lskeys.c | |
parent | key2root-addkey: mkdir /etc/key2root before saving changes (diff) | |
download | key2root-35f093ab7b01bcabbbef8b517945fa0f32950199.tar.gz key2root-35f093ab7b01bcabbbef8b517945fa0f32950199.tar.bz2 key2root-35f093ab7b01bcabbbef8b517945fa0f32950199.tar.xz |
key2root-rmkey, key2root-lskeys: check for NUL byte on truncated line
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | key2root-lskeys.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/key2root-lskeys.c b/key2root-lskeys.c index 271b0a9..a25b32d 100644 --- a/key2root-lskeys.c +++ b/key2root-lskeys.c @@ -103,8 +103,10 @@ listkeys(int dir, const char *user) } if (rhead != whead) { - fprintf(stderr, "%s: file truncated: %s/%s\n", argv0, KEYPATH, user); failed = 1; + fprintf(stderr, "%s: file truncated: %s/%s\n", argv0, KEYPATH, user); + if (memchr(&data[rhead], '\0', whead - rhead)) + fprintf(stderr, "%s: NUL byte found in %s/%s on line %zu\n", argv0, KEYPATH, user, lineno + 1); } close(fd); |