diff options
author | David Howells <dhowells@redhat.com> | 2014-01-29 20:25:06 +0000 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2014-02-21 14:04:01 +0000 |
commit | 00feb366f80b2a56d5941092c697f924c61f056f (patch) | |
tree | bc563acbc0d8cb2ebe0896181c166f59dc9d9079 | |
parent | be866f8a3b712da235fad874ab61536c05a9003f (diff) | |
download | keyutils-00feb366f80b2a56d5941092c697f924c61f056f.tar.gz |
keyctl: Fix command table searching
In the keyctl program, when searching the command table, don't trust that an
overlong argument name won't cause memcpy() to segfault. This is unlikely to
be a problem as any efficient memcpy() is going to start scanning from the
lowest address, given that it has to report on the lowest-addressed difference
if there is one.
Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r-- | keyctl.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -155,6 +155,8 @@ int main(int argc, char *argv[]) for (cmd = commands; cmd->name; cmd++) { if (!cmd->action) continue; + if (strlen(cmd->name) > n) + continue; if (memcmp(cmd->name, *argv, n) != 0) continue; |