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-rmkey.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 'key2root-rmkey.c')
-rw-r--r-- | key2root-rmkey.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/key2root-rmkey.c b/key2root-rmkey.c index c55468f..1165435 100644 --- a/key2root-rmkey.c +++ b/key2root-rmkey.c @@ -116,8 +116,11 @@ loadandremove(int fd, char **datap, size_t *lenp, size_t *sizep, const char **ke removekeys(*datap, lenp, &rhead, &rhead2, &lineno, path, keys, nkeysp); } - if (rhead != *lenp) + if (rhead != *lenp) { fprintf(stderr, "%s: file truncated: %s\n", argv0, path); + if (memchr(&(*datap)[rhead], '\0', *lenp - rhead)) + fprintf(stderr, "%s: NUL byte found in %s on line %zu\n", argv0, path, lineno + 1); + } } |