aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2018-05-12 00:19:30 +0000
committerThomas E. Dickey <dickey@invisible-island.net>2018-05-12 00:19:30 +0000
commit95c887eee01b9e2a376e18ed178e32c2bccf3ff5 (patch)
tree318d2174d9519257cc54e43ee586fec84b2cbbaa
parent7c6f0851ab90a776c3746e4384531b034a62ceca (diff)
downloadlynx-snapshots-95c887eee01b9e2a376e18ed178e32c2bccf3ff5.tar.gz
snapshot of project "lynx", label v2-8-9dev_18c
-rw-r--r--CHANGES5
-rw-r--r--WWW/Library/Implementation/HTAABrow.c14
-rw-r--r--WWW/Library/Implementation/HTAccess.c10
-rw-r--r--WWW/Library/Implementation/HTFile.c14
-rw-r--r--WWW/Library/Implementation/HTFormat.c8
-rw-r--r--WWW/Library/Implementation/HTMLGen.c16
-rw-r--r--WWW/Library/Implementation/HTString.h4
-rw-r--r--WWW/Library/Implementation/SGML.c24
-rw-r--r--src/HTFWriter.c6
-rw-r--r--src/LYDownload.c5
-rw-r--r--src/LYMain.c5
-rw-r--r--src/LYReadCFG.c4
-rw-r--r--src/LYShowInfo.c16
-rw-r--r--src/LYrcFile.c4
14 files changed, 78 insertions, 57 deletions
diff --git a/CHANGES b/CHANGES
index a4061831..94cef39e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,9 +1,10 @@
--- $LynxId: CHANGES,v 1.978 2018/05/08 21:02:36 tom Exp $
+-- $LynxId: CHANGES,v 1.980 2018/05/12 00:19:30 tom Exp $
===============================================================================
Changes since Lynx 2.8 release
===============================================================================
-2018-05-08 (2.8.9dev.19)
+2018-05-11 (2.8.9dev.19)
+* fix several minor warnings reported by Coverity -TD
* build-fix overlooked in 2.8.9dev.3 when INACTIVE_INPUT_STYLE_VH is defined,
for problem introduced by 2.8.8dev.17 code-cleanup -GV
* trim unnecessary intllib symbols from src/chrtrans/makefile.in -TD
diff --git a/WWW/Library/Implementation/HTAABrow.c b/WWW/Library/Implementation/HTAABrow.c
index 4bc1add2..c963acdd 100644
--- a/WWW/Library/Implementation/HTAABrow.c
+++ b/WWW/Library/Implementation/HTAABrow.c
@@ -1,5 +1,5 @@
/*
- * $LynxId: HTAABrow.c,v 1.42 2016/11/24 23:57:57 tom Exp $
+ * $LynxId: HTAABrow.c,v 1.43 2018/05/11 22:54:19 tom Exp $
*
* MODULE HTAABrow.c
* BROWSER SIDE ACCESS AUTHORIZATION MODULE
@@ -535,11 +535,17 @@ static HTAARealm *HTAARealm_new(HTList *realm_table,
BOOL HTAA_HaveUserinfo(const char *hostname)
{
int gen_delims = 0;
+ BOOL result = FALSE;
char *my_info = NULL;
- char *at_sign = HTSkipToAt(StrAllocCopy(my_info, hostname), &gen_delims);
- free(my_info);
- return (at_sign != NULL && gen_delims == 0) ? TRUE : FALSE;
+ if (StrAllocCopy(my_info, hostname) != NULL) {
+ char *at_sign = HTSkipToAt(my_info, &gen_delims);
+
+ free(my_info);
+ if (at_sign != NULL && gen_delims == 0)
+ result = TRUE;
+ }
+ return result;
}
/*
diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c
index 0c731d1b..ef33b877 100644
--- a/WWW/Library/Implementation/HTAccess.c
+++ b/WWW/Library/Implementation/HTAccess.c
@@ -1,5 +1,5 @@
/*
- * $LynxId: HTAccess.c,v 1.81 2018/03/29 21:41:37 tom Exp $
+ * $LynxId: HTAccess.c,v 1.84 2018/05/11 21:36:35 tom Exp $
*
* Access Manager HTAccess.c
* ==============
@@ -754,7 +754,9 @@ static BOOL HTLoadDocument(const char *full_address, /* may include #fragment */
char *cp;
BOOL ForcingNoCache = LYforce_no_cache;
- CTRACE((tfp, "HTAccess: loading document %s\n", address_to_load));
+ CTRACE((tfp, "HTAccess: loading document %s\n", NonNull(address_to_load)));
+ if (isEmpty(address_to_load))
+ return NO;
/*
* Free use_this_url_instead and reset permanent_redirection if not done
@@ -1290,6 +1292,10 @@ BOOL HTSearch(const char *keywords,
if (escaped == NULL)
outofmem(__FILE__, "HTSearch");
+ if (here->isIndexAction == NULL) {
+ free(escaped);
+ return FALSE;
+ }
StrAllocCopy(address, here->isIndexAction);
/*
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index 4cf03f69..90745749 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -1,5 +1,5 @@
/*
- * $LynxId: HTFile.c,v 1.149 2018/05/06 19:46:38 tom Exp $
+ * $LynxId: HTFile.c,v 1.151 2018/05/11 23:20:35 tom Exp $
*
* File Access HTFile.c
* ===========
@@ -997,14 +997,17 @@ HTFormat HTCharsetFormat(HTFormat format,
char *cp = NULL, *cp1, *cp2, *cp3 = NULL, *cp4;
BOOL chartrans_ok = FALSE;
int chndl = -1;
+ const char *format_name = format->name;
FREE(anchor->charset);
- StrAllocCopy(cp, format->name);
+ if (format_name == 0)
+ format_name = "";
+ StrAllocCopy(cp, format_name);
LYLowerCase(cp);
if (((cp1 = StrChr(cp, ';')) != NULL) &&
(cp2 = strstr(cp1, "charset")) != NULL) {
CTRACE((tfp, "HTCharsetFormat: Extended MIME Content-Type is %s\n",
- format->name));
+ format_name));
cp2 += 7;
while (*cp2 == ' ' || *cp2 == '=')
cp2++;
@@ -1512,14 +1515,15 @@ HTStream *HTFileSaveStream(HTParentAnchor *anchor)
/* Output one directory entry.
* ---------------------------
*/
-void HTDirEntry(HTStructured * target, const char *tail,
- const char *entry)
+void HTDirEntry(HTStructured * target, const char *tail, const char *entry)
{
char *relative = NULL;
char *stripped = NULL;
char *escaped = NULL;
int len;
+ if (entry == NULL)
+ entry = "";
StrAllocCopy(escaped, entry);
LYTrimPathSep(escaped);
if (strcmp(escaped, "..") != 0) {
diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c
index e1a173d5..46e38113 100644
--- a/WWW/Library/Implementation/HTFormat.c
+++ b/WWW/Library/Implementation/HTFormat.c
@@ -1,5 +1,5 @@
/*
- * $LynxId: HTFormat.c,v 1.89 2018/03/11 21:33:34 tom Exp $
+ * $LynxId: HTFormat.c,v 1.90 2018/05/11 22:18:24 tom Exp $
*
* Manage different file formats HTFormat.c
* =============================
@@ -865,10 +865,10 @@ int HTCopy(HTParentAnchor *anchor,
}
#endif /* NOT_ASCII */
- header_length = anchor->header_length;
+ header_length = anchor != 0 ? anchor->header_length : 0;
(*targetClass.put_block) (sink, input_buffer, status);
- if (anchor->inHEAD) {
+ if (anchor != 0 && anchor->inHEAD) {
if (!suppress_readprogress) {
statusline(gettext("Reading headers..."));
}
@@ -880,7 +880,7 @@ int HTCopy(HTParentAnchor *anchor,
* HTMIME, which detects the end of the server headers. There
* may be additional (non-header) data in that block.
*/
- if (anchor->header_length > header_length) {
+ if (anchor != 0 && (anchor->header_length > header_length)) {
int header = (int) (anchor->header_length - header_length);
CTRACE((tfp, "HTCopy read %" PRI_off_t " header bytes "
diff --git a/WWW/Library/Implementation/HTMLGen.c b/WWW/Library/Implementation/HTMLGen.c
index 2808a823..7480b0fc 100644
--- a/WWW/Library/Implementation/HTMLGen.c
+++ b/WWW/Library/Implementation/HTMLGen.c
@@ -1,5 +1,5 @@
/*
- * $LynxId: HTMLGen.c,v 1.44 2018/03/07 10:26:05 tom Exp $
+ * $LynxId: HTMLGen.c,v 1.45 2018/05/11 22:41:59 tom Exp $
*
* HTML Generator
* ==============
@@ -322,15 +322,16 @@ static int HTMLGen_start_element(HTStructured * me, int element_number,
#if defined(USE_COLOR_STYLE)
char *title = NULL;
char *title_tmp = NULL;
+ const char *name;
- if (LYPreparsedSource) {
+ if (LYPreparsedSource && (name = tag->name) != 0) {
char *myHash = NULL;
/*
* Same logic as in HTML_start_element, copied from there. - kw
*/
- HTSprintf(&Style_className, ";%s", HTML_dtd.tags[element_number].name);
- StrAllocCopy(myHash, HTML_dtd.tags[element_number].name);
+ HTSprintf(&Style_className, ";%s", name);
+ StrAllocCopy(myHash, name);
if (class_string[0]) {
StrAllocCat(myHash, ".");
StrAllocCat(myHash, class_string);
@@ -365,7 +366,7 @@ static int HTMLGen_start_element(HTStructured * me, int element_number,
if (displayStyles[element_number + STARTAT].color > -2) {
CTRACE2(TRACE_STYLE,
(tfp, "CSSTRIM: start_element: top <%s>\n",
- HTML_dtd.tags[element_number].name));
+ tag->name));
do_cstyle_flush(me);
HText_characterStyle(me->text, hcode, 1);
}
@@ -473,7 +474,7 @@ static int HTMLGen_start_element(HTStructured * me, int element_number,
* Can break after element start.
*/
if (!me->preformatted && tag->contents != SGML_EMPTY) {
- if (HTML_dtd.tags[element_number].contents == SGML_ELEMENT)
+ if (tag->contents == SGML_ELEMENT)
allow_break(me, 15, NO);
else
allow_break(me, 2, NO);
@@ -489,8 +490,7 @@ static int HTMLGen_start_element(HTStructured * me, int element_number,
(tfp, "STYLE:begin_element:ending EMPTY element style\n"));
do_cstyle_flush(me);
HText_characterStyle(me->text, hcode, STACK_OFF);
- TrimColorClass(HTML_dtd.tags[element_number].name,
- Style_className, &hcode);
+ TrimColorClass(tag->name, Style_className, &hcode);
}
#endif /* USE_COLOR_STYLE */
if (element_number == HTML_OBJECT && tag->contents == SGML_LITTERAL) {
diff --git a/WWW/Library/Implementation/HTString.h b/WWW/Library/Implementation/HTString.h
index f25dae41..a5ff20dc 100644
--- a/WWW/Library/Implementation/HTString.h
+++ b/WWW/Library/Implementation/HTString.h
@@ -1,5 +1,5 @@
/*
- * $LynxId: HTString.h,v 1.38 2013/11/28 11:09:55 tom Exp $
+ * $LynxId: HTString.h,v 1.39 2018/05/11 22:36:34 tom Exp $
* String handling for libwww
* STRINGS
*
@@ -146,7 +146,7 @@ extern "C" {
#define BINEQ(a,b) (HTSABEql(a,b)) /* like STREQ() */
-#define isBEmpty(p) ((p) == 0 || BStrLen(p) == 0)
+#define isBEmpty(p) ((p) == 0 || BStrData(p) == 0 || BStrLen(p) == 0)
#define BStrAlloc(d,n) HTSABAlloc( &(d), n)
#define BStrCopy(d,s) HTSABCopy( &(d), BStrData(s), BStrLen(s))
diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c
index 3087f0b7..fab1ad95 100644
--- a/WWW/Library/Implementation/SGML.c
+++ b/WWW/Library/Implementation/SGML.c
@@ -1,5 +1,5 @@
/*
- * $LynxId: SGML.c,v 1.161 2017/07/02 19:45:00 tom Exp $
+ * $LynxId: SGML.c,v 1.162 2018/05/11 23:46:28 tom Exp $
*
* General SGML Parser code SGML.c
* ========================
@@ -70,17 +70,13 @@ static void fake_put_character(void *p GCC_UNUSED,
AS_casecomp(a,b) : \
(TOASCII(TOUPPER(*a)) - TOASCII(TOUPPER(*b))))
- /* will use partially inlined version */
-#define orig_HTChunkPutUtf8Char HTChunkPutUtf8Char
-#undef HTChunkPutUtf8Char
-
/* ...used for comments and attributes value like href... */
#define HTChunkPutUtf8Char(ch,x) \
{ \
if ((TOASCII(x) < 128) && (ch->size < ch->allocated)) \
ch->data[ch->size++] = (char)x; \
else \
- orig_HTChunkPutUtf8Char(ch,x); \
+ (HTChunkPutUtf8Char)(ch,x); \
}
#define PUTS(str) ((*me->actions->put_string)(me->target, str))
@@ -3209,8 +3205,8 @@ static void SGML_character(HTStream *me, int c_in)
HTPassEightBitRaw &&
saved_char_in >=
LYlowest_eightbit[me->outUCLYhndl]) {
- orig_HTChunkPutUtf8Char(string,
- (UCode_t) (0xf000 | saved_char_in));
+ (HTChunkPutUtf8Char) (string,
+ (UCode_t) (0xf000 | saved_char_in));
} else {
HTChunkPutUtf8Char(string, clong);
}
@@ -3619,8 +3615,8 @@ static void SGML_character(HTStream *me, int c_in)
HTPassEightBitRaw &&
saved_char_in >=
LYlowest_eightbit[me->outUCLYhndl]) {
- orig_HTChunkPutUtf8Char(string,
- (UCode_t) (0xf000 | saved_char_in));
+ (HTChunkPutUtf8Char) (string,
+ (UCode_t) (0xf000 | saved_char_in));
} else {
HTChunkPutUtf8Char(string, clong);
}
@@ -3659,8 +3655,8 @@ static void SGML_character(HTStream *me, int c_in)
HTPassEightBitRaw &&
saved_char_in >=
LYlowest_eightbit[me->outUCLYhndl]) {
- orig_HTChunkPutUtf8Char(string,
- (UCode_t) (0xf000 | saved_char_in));
+ (HTChunkPutUtf8Char) (string,
+ (UCode_t) (0xf000 | saved_char_in));
} else {
HTChunkPutUtf8Char(string, clong);
}
@@ -3703,8 +3699,8 @@ static void SGML_character(HTStream *me, int c_in)
HTPassEightBitRaw &&
saved_char_in >=
LYlowest_eightbit[me->outUCLYhndl]) {
- orig_HTChunkPutUtf8Char(string,
- (UCode_t) (0xf000 | saved_char_in));
+ (HTChunkPutUtf8Char) (string,
+ (UCode_t) (0xf000 | saved_char_in));
} else {
HTChunkPutUtf8Char(string, clong);
}
diff --git a/src/HTFWriter.c b/src/HTFWriter.c
index f119e4a5..c4aa2f2d 100644
--- a/src/HTFWriter.c
+++ b/src/HTFWriter.c
@@ -1,5 +1,5 @@
/*
- * $LynxId: HTFWriter.c,v 1.115 2018/03/05 22:38:53 tom Exp $
+ * $LynxId: HTFWriter.c,v 1.116 2018/05/11 20:41:05 tom Exp $
*
* FILE WRITER HTFWrite.h
* ===========
@@ -179,7 +179,7 @@ static void decompress_gzip(HTStream *me)
if (success) {
if (LYRenameFile(copied, in_name) == 0)
me->anchor->actual_length = (off_t) actual;
- LYRemoveTemp(copied);
+ (void) LYRemoveTemp(copied);
}
}
#else
@@ -211,7 +211,7 @@ static void decompress_gzip(HTStream *me)
CTRACE((tfp, "command failed: %s\n", command));
}
free(command);
- LYRemoveTemp(copied);
+ (void) LYRemoveTemp(copied);
}
#undef FMT
#endif
diff --git a/src/LYDownload.c b/src/LYDownload.c
index ffaf24e4..cf1ea980 100644
--- a/src/LYDownload.c
+++ b/src/LYDownload.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYDownload.c,v 1.69 2013/10/13 20:23:07 tom Exp $ */
+/* $LynxId: LYDownload.c,v 1.70 2018/05/11 22:57:30 tom Exp $ */
#include <HTUtils.h>
#include <HTParse.h>
#include <HTList.h>
@@ -57,7 +57,8 @@ void LYDownload(char *line)
/*
* Make a copy of the LYNXDOWNLOAD internal URL for parsing. - FM
*/
- StrAllocCopy(Line, line);
+ if (StrAllocCopy(Line, line) == 0)
+ goto failed;
/*
* Parse out the File, sug_file, and the Method.
diff --git a/src/LYMain.c b/src/LYMain.c
index cba6794a..eafa7a60 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -1,5 +1,5 @@
/*
- * $LynxId: LYMain.c,v 1.280 2018/04/01 20:48:44 tom Exp $
+ * $LynxId: LYMain.c,v 1.281 2018/05/11 23:11:18 tom Exp $
*/
#include <HTUtils.h>
#include <HTTP.h>
@@ -2360,7 +2360,8 @@ void reload_read_cfg(void)
(void) LYRemoveTemp(tempfile);
FREE(tempfile);
return; /* can not write the very own file :( */
- } {
+ }
+ if (LYCookieFile != 0 && LYCookieSaveFile != 0) {
/* set few safe flags: */
#ifdef USE_PERSISTENT_COOKIES
BOOLEAN persistent_cookies_flag = persistent_cookies;
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index 2c8230be..1b6caec9 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -1,5 +1,5 @@
/*
- * $LynxId: LYReadCFG.c,v 1.192 2018/03/27 23:04:44 tom Exp $
+ * $LynxId: LYReadCFG.c,v 1.193 2018/05/11 00:03:10 tom Exp $
*/
#ifndef NO_RULES
#include <HTRules.h>
@@ -1936,6 +1936,8 @@ BOOL LYSetConfigValue(const char *name,
char *temp_name = 0;
char *temp_value = 0;
+ if (param == NULL)
+ param = "";
StrAllocCopy(value, param);
switch (tbl->type) {
case CONF_BOOL:
diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c
index 01aa5e06..3f3b3597 100644
--- a/src/LYShowInfo.c
+++ b/src/LYShowInfo.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYShowInfo.c,v 1.80 2018/05/04 22:28:57 tom Exp $ */
+/* $LynxId: LYShowInfo.c,v 1.82 2018/05/11 20:43:26 tom Exp $ */
#include <HTUtils.h>
#include <HTFile.h>
#include <HTParse.h>
@@ -71,8 +71,8 @@ static void dt_String(FILE *fp,
{
int have;
int need;
- char *the_label = 0;
- char *the_value = 0;
+ char *the_label = NULL;
+ char *the_value = NULL;
StrAllocCopy(the_label, label);
StrAllocCopy(the_value, value);
@@ -111,6 +111,8 @@ static void dt_Number(FILE *fp0,
static void dt_URL(FILE *fp0, const char *address)
{
+ if (address == NULL)
+ address = "";
ADD_WW(gettext("URL:"), address);
/*
@@ -118,7 +120,7 @@ static void dt_URL(FILE *fp0, const char *address)
* characters, show the decoded URL on the next line.
*/
if (LYCharSet_UC[current_char_set].enc == UCT_ENC_UTF8) {
- char *working = 0;
+ char *working = NULL;
StrAllocCopy(working, address);
if (strcmp(HTUnEscape(working), address)) {
@@ -142,8 +144,8 @@ int LYShowInfo(DocInfo *doc,
FILE *fp0;
char *Title = NULL;
const char *cp;
- char *temp = 0;
- char *buffer = 0;
+ char *temp = NULL;
+ char *buffer = NULL;
BOOLEAN LYInfoAdvanced = (BOOL) (user_mode == ADVANCED_MODE);
@@ -155,7 +157,7 @@ int LYShowInfo(DocInfo *doc,
if (LYReuseTempfiles) {
fp0 = LYOpenTempRewrite(tempfile, HTML_SUFFIX, "w");
} else {
- LYRemoveTemp(tempfile);
+ (void) LYRemoveTemp(tempfile);
fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w");
}
if (fp0 == NULL) {
diff --git a/src/LYrcFile.c b/src/LYrcFile.c
index 221fc0bb..1754f12e 100644
--- a/src/LYrcFile.c
+++ b/src/LYrcFile.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYrcFile.c,v 1.101 2018/03/05 22:18:05 tom Exp $ */
+/* $LynxId: LYrcFile.c,v 1.102 2018/05/11 00:27:54 tom Exp $ */
#include <HTUtils.h>
#include <HTFTP.h>
#include <LYUtils.h>
@@ -698,6 +698,8 @@ BOOL LYsetRcValue(const char *name, const char *param)
char *value = NULL;
char *orig_value = NULL;
+ if (param == NULL)
+ param = "";
StrAllocCopy(value, param);
orig_value = value;
value = LYSkipBlanks(value);