about summary refs log tree commit diff stats
path: root/WWW
diff options
context:
space:
mode:
Diffstat (limited to 'WWW')
-rw-r--r--WWW/Library/Implementation/HTNews.c14
-rw-r--r--WWW/Library/Implementation/HTParse.c6
-rw-r--r--WWW/Library/Implementation/HTString.c6
-rw-r--r--WWW/Library/Implementation/HTString.h4
-rw-r--r--WWW/Library/Implementation/HTTCP.c9
-rw-r--r--WWW/Library/Implementation/HTTP.c6
-rw-r--r--WWW/Library/Implementation/HTUtils.h3
7 files changed, 27 insertions, 21 deletions
diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c
index 5fd0e99d..c6c25636 100644
--- a/WWW/Library/Implementation/HTNews.c
+++ b/WWW/Library/Implementation/HTNews.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTNews.c,v 1.75 2020/01/21 22:12:00 tom Exp $
+ * $LynxId: HTNews.c,v 1.78 2021/06/09 19:29:36 tom Exp $
  *
  *			NEWS ACCESS				HTNews.c
  *			===========
@@ -2300,7 +2300,7 @@ static int HTLoadNews(const char *arg,
 	    } else if (*(arg + 5) == '/' && *(arg + 6) != '/') {
 		p1 = (arg + 6);
 	    } else {
-		p1 = (cp + 1);
+		p1 = (cp ? (cp + 1) : (arg + 6));
 	    }
 	    if (!(cp = HTParse(arg, "", PARSE_HOST)) || *cp == '\0') {
 		if (s >= 0 && NewsHost && strcasecomp(NewsHost, HTNewsHost)) {
@@ -2334,7 +2334,7 @@ static int HTLoadNews(const char *arg,
 	    } else if (*(arg + 6) == '/' && *(arg + 7) != '/') {
 		p1 = (arg + 7);
 	    } else {
-		p1 = (cp + 1);
+		p1 = (cp ? (cp + 1) : (arg + 7));
 	    }
 	    if (!(cp = HTParse(arg, "", PARSE_HOST)) || *cp == '\0') {
 		if (s >= 0 && NewsHost && strcasecomp(NewsHost, HTNewsHost)) {
@@ -2368,7 +2368,7 @@ static int HTLoadNews(const char *arg,
 	    } else if (*(arg + 6) != '/') {
 		p1 = (arg + 6);
 	    } else {
-		p1 = (cp + 1);
+		p1 = (cp ? (cp + 1) : (arg + 6));
 	    }
 	    if (!(cp = HTParse(arg, "", PARSE_HOST)) || *cp == '\0') {
 		if (s >= 0 && NewsHost && strcasecomp(NewsHost, HTNewsHost)) {
@@ -2436,16 +2436,18 @@ static int HTLoadNews(const char *arg,
 		    p1 = (strrchr(arg, ':') + 1);
 		}
 	    } else {
+		char *cp2;
+
 		/*
 		 * Reset p1 so that it points to the newsgroup (or a wildcard),
 		 * or the article.
 		 */
-		if (!(cp = strrchr((p1 + 6), '/')) || *(cp + 1) == '\0') {
+		if (!(cp2 = strrchr((p1 + 6), '/')) || *(cp2 + 1) == '\0') {
 		    p1 = "*";
 		    group_wanted = FALSE;
 		    list_wanted = TRUE;
 		} else {
-		    p1 = (cp + 1);
+		    p1 = (cp2 + 1);
 		}
 	    }
 	}
diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c
index a7f648fd..dd121ce4 100644
--- a/WWW/Library/Implementation/HTParse.c
+++ b/WWW/Library/Implementation/HTParse.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTParse.c,v 1.90 2020/09/05 00:19:54 tom Exp $
+ * $LynxId: HTParse.c,v 1.92 2021/06/09 19:30:55 tom Exp $
  *
  *		Parse HyperText Document Address		HTParse.c
  *		================================
@@ -822,7 +822,7 @@ void HTSimplify(char *filename, BOOL absolute)
 {
 #define MY_FMT "HTParse HTSimplify\t(%s)"
 #ifdef NO_LYNX_TRACE
-#define debug_at(at)	/* nothing */
+#define debug_at(at)		/* nothing */
 #define atln		"?"
 #else
     const char *atln;
@@ -905,7 +905,7 @@ void HTSimplify(char *filename, BOOL absolute)
 	    if (prior != filename) {
 		trim += (size_t) (filename - prior);
 		limit += (size_t) (filename - prior);
-		filename = p = prior;
+		filename = prior;
 		CTRACE2(TRACE_HTPARSE,
 			(tfp, MY_FMT " TRIM %lu/%lu (%.*s)\n",
 			 mark, (unsigned long) trim, (unsigned long) limit,
diff --git a/WWW/Library/Implementation/HTString.c b/WWW/Library/Implementation/HTString.c
index 2c663546..78054d7b 100644
--- a/WWW/Library/Implementation/HTString.c
+++ b/WWW/Library/Implementation/HTString.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTString.c,v 1.79 2020/01/23 01:10:36 tom Exp $
+ * $LynxId: HTString.c,v 1.81 2021/06/09 20:16:06 tom Exp $
  *
  *	Case-independent string comparison		HTString.c
  *
@@ -624,7 +624,7 @@ typedef enum {
 PUBLIC_IF_FIND_LEAKS char *StrAllocVsprintf(char **pstr,
 					    size_t dst_len,
 					    const char *fmt,
-					    va_list * ap)
+					    va_list *ap)
 {
 #ifdef HAVE_VASPRINTF
     /*
@@ -1102,6 +1102,8 @@ void HTAddXpand(char **result,
 		int number,
 		const char *parameter)
 {
+    if (parameter == NULL)
+	parameter = "";
     if (number > 0) {
 	const char *last = HTAfterCommandArg(command, number - 1);
 	const char *next = last;
diff --git a/WWW/Library/Implementation/HTString.h b/WWW/Library/Implementation/HTString.h
index e5ab99e8..82520ad5 100644
--- a/WWW/Library/Implementation/HTString.h
+++ b/WWW/Library/Implementation/HTString.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTString.h,v 1.40 2018/12/27 10:27:01 tom Exp $
+ * $LynxId: HTString.h,v 1.41 2021/06/09 19:30:55 tom Exp $
  *						String handling for libwww
  *                                         STRINGS
  *                                            
@@ -97,7 +97,7 @@ extern "C" {
     extern char *StrAllocVsprintf(char **pstr,
 				  size_t len,
 				  const char *fmt,
-				  va_list * ap);
+				  va_list *ap);
 #endif
 
 #if defined(__CYGWIN__)
diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c
index 945c9f91..c4d648ac 100644
--- a/WWW/Library/Implementation/HTTCP.c
+++ b/WWW/Library/Implementation/HTTCP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTTCP.c,v 1.157 2020/09/03 22:57:14 tom Exp $
+ * $LynxId: HTTCP.c,v 1.160 2021/06/08 23:44:43 tom Exp $
  *
  *			Generic Communication Code		HTTCP.c
  *			==========================
@@ -1600,7 +1600,7 @@ static void really_getaddrinfo(const char *host,
 #ifdef DEBUG_HOSTENT_CHILD
 	dump_addrinfo("CHILD fill_addrinfo", (const LYNX_ADDRINFO *) (*result));
 #endif
-	if (statuses->rehostentlen <= sizeof(LYNX_ADDRINFO)) {
+	if (statuses->rehostentlen <= sizeof(LYNX_ADDRINFO) || (*result) == NULL) {
 	    statuses->rehostentlen = 0;
 	    statuses->h_length = 0;
 	} else {
@@ -1825,7 +1825,7 @@ int HTDoConnect(const char *url,
 		int default_port,
 		int *s)
 {
-    char *socks5_host;
+    char *socks5_host = NULL;
     unsigned socks5_host_len = 0;
     int socks5_port;
     const char *socks5_orig_url;
@@ -1858,7 +1858,6 @@ int HTDoConnect(const char *url,
 	StrAllocCopy(socks5_new_url, url);
 
 	/* Get node name and optional port number of wanted URL */
-	socks5_host = NULL;
 	if ((p1 = HTParse(socks5_new_url, "", PARSE_HOST)) != NULL) {
 	    StrAllocCopy(socks5_host, p1);
 	    strip_userid(socks5_host, FALSE);
@@ -2301,7 +2300,7 @@ int HTDoConnect(const char *url,
 	}
 	if ((size_t) write(*s, pbuf, i) != i) {
 	    goto report_system_err;
-	} else if ((i = (unsigned) HTDoRead(*s, pbuf, 4)) != 4) {
+	} else if ((unsigned) HTDoRead(*s, pbuf, 4) != 4) {
 	    goto report_system_err;
 	}
 	/* Version 5, reserved must be 0 */
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index 7e0234aa..07e30d74 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTTP.c,v 1.178 2020/01/21 22:09:33 tom Exp $
+ * $LynxId: HTTP.c,v 1.179 2021/06/08 23:28:23 tom Exp $
  *
  * HyperText Transfer Protocol	- Client implementation		HTTP.c
  * ===========================
@@ -755,7 +755,9 @@ static char *StripIpv6Brackets(char *host)
 	p = host + strlen(host) - 1;
 	if (*p == ']') {
 	    *p = '\0';
-	    ++host;
+	    for (p = host; (p[0] = p[1]) != '\0'; ++p) {
+		;		/* EMPTY */
+	    }
 	}
     }
     return host;
diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h
index 57aa64e7..5aedc2f4 100644
--- a/WWW/Library/Implementation/HTUtils.h
+++ b/WWW/Library/Implementation/HTUtils.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTUtils.h,v 1.132 2021/03/22 23:03:56 tom Exp $
+ * $LynxId: HTUtils.h,v 1.133 2021/06/09 22:17:19 tom Exp $
  *
  * Utility macros for the W3 code library
  * MACROS FOR GENERAL USE
@@ -685,6 +685,7 @@ extern int WWW_TraceMask;
  * Printing-format for "UCode_t".
  */
 #define PRI_UCode_t	"lX"
+#define CAST_UCode_t(n)	(unsigned long)(n)
 
 /*
  * Verbose-tracing.