summaryrefslogtreecommitdiff
path: root/bits.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-09-11 18:04:08 -0400
committerEric S. Raymond <esr@thyrsus.com>2014-09-11 18:04:08 -0400
commita4b9e137ed23881c63693a9cade62f630aced24e (patch)
treebd593235079e94d17e6b57be52c1efd2a5e767f0 /bits.c
parent280d52b7d78ad2ba695f5f6faa61f0679c447f3c (diff)
downloadgpsd-a4b9e137ed23881c63693a9cade62f630aced24e.tar.gz
Coverity caught a subtle bug in bits.c::shift_left().
Diffstat (limited to 'bits.c')
-rw-r--r--bits.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bits.c b/bits.c
index 775b9682..19a86b47 100644
--- a/bits.c
+++ b/bits.c
@@ -139,7 +139,7 @@ void shiftleft(unsigned char *data, int size, unsigned short left)
if (left >= CHAR_BIT) {
size -= left/CHAR_BIT;
- memmove(data, data + left/CHAR_BIT, size);
+ memmove(data, data + left/CHAR_BIT, (size + CHAR_BIT - 1)/CHAR_BIT);
left %= CHAR_BIT;
}