Skip to content

Commit

Permalink
core: parse uri - cast to unsigned for left shifting
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Apr 2, 2021
1 parent f21ad75 commit d4e31e6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/core/parser/parse_uri.c
Expand Up @@ -26,6 +26,8 @@
*/


#include <stdint.h>

#include "../globals.h"
#include "parse_uri.h"
#include <string.h>
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d4e31e6

Please sign in to comment.