Commit 74324bbb authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Fix possible NULL pointer dereference, add clarity

decompress.c: remove double assignment to ses->compression, let it fall through
start.c: don't dereference 'ses' until after the check for it being NULL
Found by cppcheck static analysis.

Version 1.00. Tagged as 'HTTP-1_00'
parent 7331271d
/* (0.99) /* (1.00)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1. * Last processed by srccommit version: 1.1.
* *
*/ */
#define Module_MajorVersion_CMHG 0.99 #define Module_MajorVersion_CMHG 1.00
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 25 Aug 2018 #define Module_Date_CMHG 25 Sep 2018
#define Module_MajorVersion "0.99" #define Module_MajorVersion "1.00"
#define Module_Version 99 #define Module_Version 100
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "25 Aug 2018" #define Module_Date "25 Sep 2018"
#define Module_ApplicationDate "25-Aug-18" #define Module_ApplicationDate "25-Sep-18"
#define Module_ComponentName "HTTP" #define Module_ComponentName "HTTP"
#define Module_ComponentPath "castle/RiscOS/Sources/Networking/Fetchers/HTTP" #define Module_ComponentPath "castle/RiscOS/Sources/Networking/Fetchers/HTTP"
#define Module_FullVersion "0.99" #define Module_FullVersion "1.00"
#define Module_HelpVersion "0.99 (25 Aug 2018)" #define Module_HelpVersion "1.00 (25 Sep 2018)"
#define Module_LibraryVersionInfo "0:99" #define Module_LibraryVersionInfo "1:0"
...@@ -419,7 +419,7 @@ int decompress(Session *ses, char *buffer, int bufsize, int toread, int *rawread ...@@ -419,7 +419,7 @@ int decompress(Session *ses, char *buffer, int bufsize, int toread, int *rawread
ses->zstream.avail_in -= 8; ses->zstream.avail_in -= 8;
ses->compstate = compress_FINISHED; ses->compstate = compress_FINISHED;
ses->compression = compression_NONE; /* Fall through */
case compress_FINISHED: case compress_FINISHED:
dataread=0; dataread=0;
......
...@@ -767,10 +767,13 @@ static int http_parse_url(Session *ses, char *proxied) ...@@ -767,10 +767,13 @@ static int http_parse_url(Session *ses, char *proxied)
{ {
char *host = NULL; char *host = NULL;
char *uri = NULL; char *uri = NULL;
char *url = ses->url; char *url;
int port = (ses->flags & flags_USING_HTTPS) ? CONNECT_DEFAULT_PORT_NUMBER2:CONNECT_DEFAULT_PORT_NUMBER; int port;
if (!ses || !url || !*url ) return -1; if (!ses) return -1;
url = ses->url;
port = (ses->flags & flags_USING_HTTPS) ? CONNECT_DEFAULT_PORT_NUMBER2:CONNECT_DEFAULT_PORT_NUMBER;
if (!url || !*url ) return -1;
#ifdef TRACE #ifdef TRACE
protocol_debug("URL is `%s', Proxy is `%s'\n", ses->url, proxied?proxied:"<UNSET>"); protocol_debug("URL is `%s', Proxy is `%s'\n", ses->url, proxied?proxied:"<UNSET>");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment