[nginx] Added type cast to ngx_proxy_protocol_parse_uint16().

Roman Arutyunyan arut at nginx.com
Wed Oct 12 14:37:01 UTC 2022


details:   https://hg.nginx.org/nginx/rev/aa663cc2a77d
branches:  
changeset: 8073:aa663cc2a77d
user:      Roman Arutyunyan <arut at nginx.com>
date:      Tue Sep 27 11:31:16 2022 +0400
description:
Added type cast to ngx_proxy_protocol_parse_uint16().

The cast is added to make ngx_proxy_protocol_parse_uint16() similar to
ngx_proxy_protocol_parse_uint32().

diffstat:

 src/core/ngx_proxy_protocol.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (14 lines):

diff -r cca4c8a715de -r aa663cc2a77d src/core/ngx_proxy_protocol.c
--- a/src/core/ngx_proxy_protocol.c	Wed Oct 12 16:58:16 2022 +0400
+++ b/src/core/ngx_proxy_protocol.c	Tue Sep 27 11:31:16 2022 +0400
@@ -13,7 +13,9 @@
 #define NGX_PROXY_PROTOCOL_AF_INET6         2
 
 
-#define ngx_proxy_protocol_parse_uint16(p)  ((p)[0] << 8 | (p)[1])
+#define ngx_proxy_protocol_parse_uint16(p)                                    \
+    ( ((uint16_t) (p)[0] << 8)                                                \
+    + (           (p)[1]) )
 
 #define ngx_proxy_protocol_parse_uint32(p)                                    \
     ( ((uint32_t) (p)[0] << 24)                                               \



More information about the nginx-devel mailing list