summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSamuel Lidén Borell <samuel@kodafritt.se>2014-02-15 22:10:43 +0000
committerBerke Viktor <github.bviktor@outlook.com>2014-06-02 23:47:27 +0200
commitd8c80cd277b2f6b3e7955e95d7845f83b89838c6 (patch)
treed55ee429c0afd311171c890946fa5f034ae55b02
parent3fb04bee857a2c53dfdc66359aa2437864c07104 (diff)
Fix undefined behaviour in left shift
This is not a problem with a usual compiler configuration, but LLVM/clang
detects it when compiled with:

-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error -ftrapv
-rw-r--r--plugins/fishlim/fish.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/fishlim/fish.c b/plugins/fishlim/fish.c
index 1d2d1ce7..93420f23 100644
--- a/plugins/fishlim/fish.c
+++ b/plugins/fishlim/fish.c
@@ -136,7 +136,7 @@ char *fish_decrypt(const char *key, size_t keylen, const char *data) {
         for (i = 0; i < 12; i++) {
             d = fish_unbase64[(const unsigned char)*(data++)];
             if (d == IB) goto decrypt_end;
-            binary[word] |= d << bit;
+            binary[word] |= (unsigned long)d << bit;
             bit += 6;
             if (i == 5) {
                 bit = 0;