Module: kamailio
Branch: master
Commit: d4e31e6ae494836c49e50f463517a576b18c5611
URL:
https://github.com/kamailio/kamailio/commit/d4e31e6ae494836c49e50f463517a57…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-04-02T09:38:55+02:00
core: parse uri - cast to unsigned for left shifting
---
Modified: src/core/parser/parse_uri.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d4e31e6ae494836c49e50f463517a57…
Patch:
https://github.com/kamailio/kamailio/commit/d4e31e6ae494836c49e50f463517a57…
---
diff --git a/src/core/parser/parse_uri.c b/src/core/parser/parse_uri.c
index ec39ea7cf2..2c24054d2c 100644
--- a/src/core/parser/parse_uri.c
+++ b/src/core/parser/parse_uri.c
@@ -26,6 +26,8 @@
*/
+#include <stdint.h>
+
#include "../globals.h"
#include "parse_uri.h"
#include <string.h>
@@ -124,7 +126,7 @@ int parse_uri(char* buf, int len, struct sip_uri* uri)
char* pass;
int found_user;
int error_headers;
- unsigned int scheme;
+ uint32_t scheme;
uri_type backup_urit;
uri_flags backup_urif;
@@ -386,9 +388,10 @@ int parse_uri(char* buf, int len, struct sip_uri* uri)
port_no=0;
state=URI_INIT;
memset(uri, 0, sizeof(struct sip_uri)); /* zero it all, just to be sure*/
- /*look for sip:, sips: ,tel: or urn:*/
+ /*look for sip:, sips:, tel: or urn:*/
if (len<5) goto error_too_short;
- scheme=buf[0]+(buf[1]<<8)+(buf[2]<<16)+(buf[3]<<24);
+ scheme=((uint32_t)buf[0]) + (((uint32_t)buf[1])<<8)
+ + (((uint32_t)buf[2])<<16) + (((uint32_t)buf[3])<<24);
scheme|=0x20202020;
if (scheme==SIP_SCH){
uri->type=SIP_URI_T;