diff options
author | jilles <jilles@FreeBSD.org> | 2015-06-24 20:51:48 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2015-06-24 20:51:48 +0000 |
commit | 3c6c0527e691b4906e8ad2527fb2bfd2a8782cc1 (patch) | |
tree | bfc73dd1014492df563dc7bc078592da9eac68b2 /bin/sh/alias.c | |
parent | 70cda65ad974bbd25e7cb9eb77b9026933d83842 (diff) | |
download | FreeBSD-src-3c6c0527e691b4906e8ad2527fb2bfd2a8782cc1.zip FreeBSD-src-3c6c0527e691b4906e8ad2527fb2bfd2a8782cc1.tar.gz |
sh: Fix some arithmetic undefined behaviour.
Fix shifts of possibly negative numbers found with ubsan and avoid signed
integer overflow when hashing an extremely long command name.
MFC after: 1 week
Diffstat (limited to 'bin/sh/alias.c')
-rw-r--r-- | bin/sh/alias.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/sh/alias.c b/bin/sh/alias.c index 21f3f44..a77ce99 100644 --- a/bin/sh/alias.c +++ b/bin/sh/alias.c @@ -248,7 +248,7 @@ hashalias(const char *p) { unsigned int hashval; - hashval = *p << 4; + hashval = (unsigned char)*p << 4; while (*p) hashval+= *p++; return &atab[hashval % ATABSIZE]; |