diff options
Diffstat (limited to 'WWW')
-rw-r--r-- | WWW/Library/Implementation/HTAABrow.c | 14 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTAccess.c | 10 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTFile.c | 14 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTFormat.c | 8 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTMLGen.c | 16 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTString.h | 4 | ||||
-rw-r--r-- | WWW/Library/Implementation/SGML.c | 24 |
7 files changed, 51 insertions, 39 deletions
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); } |