Commit a4d1d98d authored by ROOL's avatar ROOL 🤖
Browse files

Error and cookie handling improvements

Detail:
  Use GETDCI4ERRNO macro to safely extract errno from RISC OS error blocks.
  Fix for NULL pointer dereference when adding the first cookie to the cookie queue.
Admin:
  Submission for TCP/IP bounty.

Version 0.96. Tagged as 'HTTP-0_96'
parent 920f9213
/* (0.95)
/* (0.96)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.95
#define Module_MajorVersion_CMHG 0.96
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 12 May 2018
#define Module_MajorVersion "0.95"
#define Module_Version 95
#define Module_MajorVersion "0.96"
#define Module_Version 96
#define Module_MinorVersion ""
#define Module_Date "12 May 2018"
......@@ -18,6 +18,6 @@
#define Module_ComponentName "HTTP"
#define Module_ComponentPath "castle/RiscOS/Sources/Networking/Fetchers/HTTP"
#define Module_FullVersion "0.95"
#define Module_HelpVersion "0.95 (12 May 2018)"
#define Module_LibraryVersionInfo "0:95"
#define Module_FullVersion "0.96"
#define Module_HelpVersion "0.96 (12 May 2018)"
#define Module_LibraryVersionInfo "0:96"
......@@ -279,7 +279,9 @@ static void add_cookie_to_queue(Cookie *cookie)
/* Set to head of list */
cookie->previous = NULL;
cookie->next = cookie_queue_root;
cookie_queue_root->previous = cookie;
if (cookie_queue_root != NULL) {
cookie_queue_root->previous = cookie; /* Non empty list */
}
cookie_queue_root = cookie;
/* Set bit 16 in URL status flag to indicate new cookie */
/* Increase the number of unread cookies by one */
......
......@@ -153,6 +153,7 @@ static int sec_recv(int s, void *data, size_t size, int flags)
#else
#include "sys/dcistructs.h"
#include "Interface/AcornSSL.h"
static int sec_socketioctl(int s, unsigned long op, ...)
......@@ -169,7 +170,7 @@ static int sec_socketioctl(int s, unsigned long op, ...)
e = _swix(AcornSSL_Ioctl, _INR(0,2)|_OUT(0),
s, op, data, &result);
if (!e) return result;
errno = e->errnum;
errno = GETDCI4ERRNO(e->errnum);
return -1;
}
......@@ -182,7 +183,7 @@ static int sec_socket(int domain, int type, int protocol)
domain, type, protocol,
&result);
if (!e) return result;
errno = e->errnum;
errno = GETDCI4ERRNO(e->errnum);
return -1;
}
......@@ -195,7 +196,7 @@ static int sec_connect(int s, const struct sockaddr *name, int namelen)
s, name, namelen,
&result);
if (!e) return result;
errno = e->errnum;
errno = GETDCI4ERRNO(e->errnum);
return -1;
}
......@@ -208,7 +209,7 @@ static int sec_shutdown(int s, int how)
s, how,
&result);
if (!e) return result;
errno = e->errnum;
errno = GETDCI4ERRNO(e->errnum);
return -1;
}
......@@ -221,7 +222,7 @@ static int sec_socketclose(int d)
d,
&result);
if (!e) return result;
errno = e->errnum;
errno = GETDCI4ERRNO(e->errnum);
return -1;
}
......@@ -235,7 +236,7 @@ static int sec_getsockopt(int s, int level, int optname,
s, level, optname, optval, optlen,
&result);
if (!e) return result;
errno = e->errnum;
errno = GETDCI4ERRNO(e->errnum);
return -1;
}
......@@ -248,7 +249,7 @@ static int sec_socketwrite(int s, const void *buf, unsigned int len)
s, buf, len,
&result);
if (!e) return result;
errno = e->errnum;
errno = GETDCI4ERRNO(e->errnum);
return -1;
}
......@@ -261,7 +262,7 @@ static int sec_recv(int s, void *data, size_t size, int flags)
s, data, size, flags,
&result);
if (!e) return result;
errno = e->errnum;
errno = GETDCI4ERRNO(e->errnum);
return -1;
}
#endif
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