diff options
Diffstat (limited to 'rpmio/rpmstrpool.c')
-rw-r--r-- | rpmio/rpmstrpool.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/rpmio/rpmstrpool.c b/rpmio/rpmstrpool.c index 776ca6dea..0db0b5313 100644 --- a/rpmio/rpmstrpool.c +++ b/rpmio/rpmstrpool.c @@ -88,11 +88,12 @@ static inline unsigned int rstrnlenhash(const char * str, size_t n, size_t * len unsigned int hash = 0xe4721b68; const char * s = str; - while (*s != '\0' && n-- > 0) { + while (n > 0 && *s != '\0') { hash += *s; hash += (hash << 10); hash ^= (hash >> 6); s++; + n--; } hash += (hash << 3); hash ^= (hash >> 11); |