[Pkg-privacy-commits] [libotr] 79/225: Fix sign-extension potential problem on 64-bit machines
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 12:44:58 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository libotr.
commit 8afbb7d37cd96cb2c42cab87d867ef05fe1707e7
Author: Ian Goldberg <iang at cs.uwaterloo.ca>
Date: Thu Jun 28 10:23:39 2012 -0400
Fix sign-extension potential problem on 64-bit machines
(It wouldn't appear in practice, as we don't send around >2GB objects,
but still, better to close a possible attack vector.)
---
src/serial.h | 4 ++--
toolkit/parse.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/serial.h b/src/serial.h
index fea2850..cd2442b 100644
--- a/src/serial.h
+++ b/src/serial.h
@@ -37,7 +37,7 @@
#define debug_int(t,b) do { const unsigned char *data = (b); \
unsigned int v = \
- (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; \
+ (((unsigned int)data[0]) << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; \
fprintf(stderr, "%s: %u (0x%x)\n", (t), v, v); \
} while(0)
@@ -67,7 +67,7 @@
#define read_int(x) do { \
require_len(4); \
- (x) = (bufp[0] << 24) | (bufp[1] << 16) | (bufp[2] << 8) | bufp[3]; \
+ (x) = (((unsigned int)bufp[0]) << 24) | (bufp[1] << 16) | (bufp[2] << 8) | bufp[3]; \
bufp += 4; lenp -= 4; \
} while(0)
diff --git a/toolkit/parse.c b/toolkit/parse.c
index ef67c8e..36f935e 100644
--- a/toolkit/parse.c
+++ b/toolkit/parse.c
@@ -86,7 +86,7 @@ static unsigned char *decode(const char *msg, size_t *lenp)
#define require_len(l) do { if (lenp < (l)) goto inv; } while(0)
#define read_int(x) do { \
require_len(4); \
- (x) = (bufp[0] << 24) | (bufp[1] << 16) | (bufp[2] << 8 ) | bufp[3]; \
+ (x) = (((unsigned int)bufp[0]) << 24) | (bufp[1] << 16) | (bufp[2] << 8 ) | bufp[3]; \
bufp += 4; lenp -= 4; \
} while(0)
#define read_mpi(x) do { \
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/libotr.git
More information about the Pkg-privacy-commits
mailing list