From: Matt Caswell Date: Thu, 7 Jul 2016 14:51:17 +0000 (+0100) Subject: Fix bug with s2n et al macros X-Git-Tag: OpenSSL_1_1_0-pre6~185 X-Git-Url: https://git.openssl.org/?p=openssl.git;a=commitdiff_plain;h=d4450e4bb95de561de54c6319596bf5637062337;hp=c76a4aead2660f417608eead5cdff81f04021220 Fix bug with s2n et al macros The parameters should have parens around them when used. Reviewed-by: Richard Levitte --- diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h index 8287077bba..1cc63aa819 100644 --- a/ssl/ssl_locl.h +++ b/ssl/ssl_locl.h @@ -141,18 +141,18 @@ } \ } -# define n2s(c,s) ((s=(((unsigned int)(c[0]))<< 8)| \ - (((unsigned int)(c[1])) )),c+=2) -# define s2n(s,c) ((c[0]=(unsigned char)(((s)>> 8)&0xff), \ - c[1]=(unsigned char)(((s) )&0xff)),c+=2) - -# define n2l3(c,l) ((l =(((unsigned long)(c[0]))<<16)| \ - (((unsigned long)(c[1]))<< 8)| \ - (((unsigned long)(c[2])) )),c+=3) - -# define l2n3(l,c) ((c[0]=(unsigned char)(((l)>>16)&0xff), \ - c[1]=(unsigned char)(((l)>> 8)&0xff), \ - c[2]=(unsigned char)(((l) )&0xff)),c+=3) +# define n2s(c,s) ((s=(((unsigned int)((c)[0]))<< 8)| \ + (((unsigned int)((c)[1])) )),(c)+=2) +# define s2n(s,c) (((c)[0]=(unsigned char)(((s)>> 8)&0xff), \ + (c)[1]=(unsigned char)(((s) )&0xff)),(c)+=2) + +# define n2l3(c,l) ((l =(((unsigned long)((c)[0]))<<16)| \ + (((unsigned long)((c)[1]))<< 8)| \ + (((unsigned long)((c)[2])) )),(c)+=3) + +# define l2n3(l,c) (((c)[0]=(unsigned char)(((l)>>16)&0xff), \ + (c)[1]=(unsigned char)(((l)>> 8)&0xff), \ + (c)[2]=(unsigned char)(((l) )&0xff)),(c)+=3) #define DTLS_VERSION_GT(v1, v2) ((v1) < (v2)) #define DTLS_VERSION_GE(v1, v2) ((v1) <= (v2))