Commit f7e0d0cf authored by Axel Beckert's avatar Axel Beckert

Imported Upstream version 2.8.8dev.16

parent b3fed630
-- $LynxId: CHANGES,v 1.634 2012/11/18 21:54:53 tom Exp $
-- $LynxId: CHANGES,v 1.652 2013/07/29 00:56:09 tom Exp $
===============================================================================
Changes since Lynx 2.8 release
===============================================================================
2013-07-29 (2.8.8dev.16)
* build-fix for setmode() definition on Cygwin -TD
* modify HTUtils.h to work around header conflict with Cygwin w32api and
openssl 1.0.1e (prompted by report/patch by Supriyo Biswas) -TD
* protect redefined errno values for Windows port from redefinition warnings
when using MinGW build, since the WSAxxx values are what the configuration
actually uses -TD
* modify <address> tag to treat it like <p> when used within a list -TD
* update fi.po from
http://translationproject.org/latest/lynx
* add on/off toggles to options menu for the color-style and default-colors
features, to help deal with packages which enable default colors without
adjusting the color-style settings to avoid having yellow text on a white
background (report by Stephen Isard) -TD
* add -default-colors command-line option to allow toggling the state of the
DEFAULT_COLORS setting from lynx.cfg -TD
* improve discussion of -dump and -force_html in manpage (Ubuntu #1112568) -TD
* cleanup quoting and use of ASCII "-" versus hyphen in manpage -TD
* add checks for zero-length strings in a few places to prevent infinite loop
when the focus moves to a text-field which is past the right margin due to
improper placement for the nested-tables configuration (report by Rajeev V
Pillai) -TD
* update doctype for html documentation to 4.01 strict -TD
* correct handling of backslash in TrimCommand() function introduced in
2.8.6dev.4, used to process the commands for "test=" in mime-types -TD
* correct 2.8.3dev.13 check for permissible place to split UTF-8 encoded text,
reported by Coverity -TD
* make DONT_TRACK_INTERNAL_LINKS logic configurable via lynx.cfg as
TRACK_INTERNAL_LINKS; the configure script now sets the default value -TD
* fix most issues found by clang 3.2 analyze -TD
* fix most issues found by Coverity scan -TD
2012-11-18 (2.8.8dev.15)
* corrected position of highlighting from search/whereis function when using
multibyte characters (Debian #673385) -TD
......@@ -271,7 +303,7 @@ Changes since Lynx 2.8 release
* remind user how to cancel message (Debian #292787) -TD
* add HTML5_CHARSETS feature, which allows the user to choose whether to
interpret pages without an explicit charset according to the HTML5
"compatibility" feature (Debian #604466, #514897) -TD
"compatibility" feature (Debian #604466, Debian #514897) -TD
* add EXTERNAL_MENU feature to lynx.cfg, which allows the user to customize the
menu-entry shown, e.g., to suppress the display of the URL
(Debian #603646) -TD
......@@ -910,7 +942,7 @@ Changes since Lynx 2.8 release
by discussion by Chuck Houpt and TG) -TD
* fix an off-by-one in HText_canScrollDown() and total_pages in GridText.c -TH
* rewrite strcasecomp_asterisk() to support wildcards as in RFC 2818 (prompted
by less-complete Debian patch for #401447, see also #268102) -TD
by less-complete patch from Debian #401447, see also Debian #268102) -TD
* improve X.509 certificate validation -TG
This is tested for OpenSSL, ifdef'd to not break gnutls. Changes:
+ peer certificate is cached, no need to call SSL_get_peer_certificate()
......@@ -1202,7 +1234,7 @@ Changes since Lynx 2.8 release
if it cannot find the lss file. cf: 2000-07-16 (2.8.4dev.5) -TD
* fix a sign-extension in alignment case-statement in split_line() which could
cause a large indent for lines which are wider than the display (Debian
#360832, #372670) -TD
#360832, Debian #372670) -TD
* fix ifdef's in LYOptions.c to make --disable-menu-options work (report by
PW) -TD
......@@ -8211,16 +8243,16 @@ recently, FreeBSD 4.1, NetBSD 1.5 and OpenBSD 2.8 (curses/ncurses).
1998-09-08 (2.8.1dev25-intl)
* Resynch with dev tree - JES
1998-09-07 (2.8.1dev.21-intl)
1998-09-07 (2.8.1dev.21-intl p3)
* About half through language hooks in WWW/Lib... - JES
Integrated part of Chebucto's French translations - JES
* Included latest ABOUT-NLS from GNU project,
1998-08-27 (2.8.1dev.21-intl)
1998-08-27 (2.8.1dev.21-intl p2)
* Tested language hooks using src/LYNews.c and Italian messages file
provided by Sabato De Rosa <sabato.derosa@usa.net>. Made changes to
LYMain.c, LYMainLoop.c, LYNews.c and HTNews.c - JES
1998-08-27 (2.8.1dev.21-intl)
1998-08-27 (2.8.1dev.21-intl p1)
* add hooks to GNU gettext for international language support - JES
(This is an experimental modification that will be patched into
the main Lynx release after other platform testing. I've only done
......
......@@ -460,7 +460,7 @@ II. Compile instructions -- UNIX
generate an HTMLized copy of lynx.cfg which will be installed with
the other help files.
--enable-internal-links (prevent defining DONT_TRACK_INTERNAL_LINKS)
--enable-internal-links (define TRACK_INTERNAL_LINKS)
With `internal links' (links within a document to a location within
the same document) enabled, Lynx will distinguish between, for example,
`<A HREF="foo#frag">' and `<A HREF="#frag">' within a document whose
......@@ -1455,4 +1455,4 @@ VIII. Acknowledgment
-- 1999/04/24 - H. Nelson <lynx-admin@irm.nara.kindai.ac.jp>
-- vile:txtmode
-- $LynxId: INSTALLATION,v 1.120 2012/07/06 11:53:52 tom Exp $
-- $LynxId: INSTALLATION,v 1.121 2013/04/30 09:47:15 tom Exp $
lynx-dev (2.8.8dev.16) unstable; urgency=high
* changes for dev.16
-- Thomas E. Dickey <dickey@invisible-island.net> Tue, 30 Apr 2013 04:32:34 -0400
lynx-dev (2.8.8dev.15) unstable; urgency=high
* changes for dev.15
......
# $LynxId: lynx.spec,v 1.16 2012/11/17 01:55:11 tom Exp $
# $LynxId: lynx.spec,v 1.17 2013/04/30 08:32:37 tom Exp $
Summary: A text-based Web browser
Name: lynx
Version: 2.8.8
Release: dev.15
Release: dev.16
License: GPLv2
Group: Applications/Internet
Source: lynx%{version}%{release}.tgz
......
; version used for Inno Setup files.
; $Format: "#define LYNX_VERSION \"$ProjectVersion$\""$
#define LYNX_VERSION "2.8.8dev.15"
#define LYNX_VERSION "2.8.8dev.16"
; most-recent full release and target
#define LYNX_RELEASE "2.8.7"
......
/*
* $LynxId: HTAABrow.c,v 1.34 2010/09/24 08:27:42 tom Exp $
* $LynxId: HTAABrow.c,v 1.39 2013/07/21 00:14:39 tom Exp $
*
* MODULE HTAABrow.c
* BROWSER SIDE ACCESS AUTHORIZATION MODULE
......@@ -638,7 +638,7 @@ static char *compose_auth_string(HTAAScheme scheme, HTAASetup * setup, int IsPro
NonNull(thePort));
FREE(proxiedHost);
FREE(thePort);
username = realm->username;
StrAllocCopy(username, realm->username);
password = NULL;
HTPromptUsernameAndPassword(msg, &username, &password, IsProxy);
......@@ -747,7 +747,7 @@ static HTAAScheme HTAA_selectScheme(HTAASetup * setup)
if (setup && setup->valid_schemes) {
for (scheme = HTAA_BASIC; scheme < HTAA_MAX_SCHEMES; scheme++) {
void *object = (void *) scheme;
void *object = (void *) (intptr_t) scheme;
if (-1 < HTList_indexOf(setup->valid_schemes, object))
return (HTAAScheme) scheme;
......@@ -1058,6 +1058,7 @@ BOOL HTAA_shouldRetryWithAuth(char *start_of_headers,
HTAssocList **scheme_specifics = NULL;
char *ctemplate = NULL;
char *temp = NULL;
BOOL result = NO;
/*
* Setup atexit() freeing if not done already. - FM
......@@ -1147,12 +1148,12 @@ BOOL HTAA_shouldRetryWithAuth(char *start_of_headers,
* No proxy authorization valid
*/
proxy_setup = NULL;
return NO;
result = NO;
}
/*
* Doing it for proxy. -AJL
*/
if (proxy_setup && proxy_setup->server) {
else if (proxy_setup && proxy_setup->server) {
/*
* We have already tried with proxy authorization. Either we don't
* have access or username or password was misspelled.
......@@ -1164,13 +1165,14 @@ BOOL HTAA_shouldRetryWithAuth(char *start_of_headers,
if (NO == HTConfirm(AUTH_FAILED_PROMPT)) {
proxy_setup = NULL;
return NO;
result = NO;
} else {
/*
* Re-ask username+password (if misspelled).
*/
HTList_delete(valid_schemes);
proxy_setup->retry = YES;
return YES;
result = YES;
}
} else {
/*
......@@ -1196,21 +1198,19 @@ BOOL HTAA_shouldRetryWithAuth(char *start_of_headers,
FREE(ctemplate);
HTAlert(gettext("Proxy authorization required -- retrying"));
return YES;
result = YES;
}
/* Never reached */
}
/*
* Normal WWW authorization.
*/
if (num_schemes == 0) {
else if (num_schemes == 0) {
/*
* No authorization valid.
*/
current_setup = NULL;
return NO;
}
if (current_setup && current_setup->server) {
result = NO;
} else if (current_setup && current_setup->server) {
/*
* So we have already tried with WWW authorization. Either we don't
* have access or username or password was misspelled.
......@@ -1222,13 +1222,13 @@ BOOL HTAA_shouldRetryWithAuth(char *start_of_headers,
if (NO == HTConfirm(AUTH_FAILED_PROMPT)) {
current_setup = NULL;
return NO;
result = NO;
} else {
/*
* Re-ask username+password (if misspelled).
*/
current_setup->retry = YES;
return YES;
result = YES;
}
} else {
/*
......@@ -1254,9 +1254,13 @@ BOOL HTAA_shouldRetryWithAuth(char *start_of_headers,
FREE(ctemplate);
HTAlert(gettext("Access without authorization denied -- retrying"));
return YES;
result = YES;
}
if (result == NO) {
HTList_delete(valid_schemes);
}
/* Never reached */
return result;
}
/*
......
/*
* $LynxId: HTAAUtil.c,v 1.31 2010/09/24 23:51:22 tom Exp $
* $LynxId: HTAAUtil.c,v 1.35 2013/05/03 20:32:37 tom Exp $
*
* MODULE HTAAUtil.c
* COMMON PARTS OF ACCESS AUTHORIZATION MODULE
......@@ -495,8 +495,7 @@ void HTAA_setupReader(char *start_of_headers,
#endif
start_pointer = buffer;
if (start_of_headers) {
StrNCpy(buffer, start_of_headers, length);
buffer[length] = '\0';
LYStrNCpy(buffer, start_of_headers, length);
end_pointer = buffer + length;
} else {
*start_pointer = '\0';
......@@ -557,6 +556,8 @@ char *HTAA_getUnfoldedLine(void)
in_soc = -1;
return line;
}
if (count > (int) buffer_length)
count = (int) buffer_length;
start_pointer = buffer;
end_pointer = buffer + count;
*end_pointer = '\0';
......
/*
* $LynxId: HTAccess.c,v 1.77 2012/02/23 00:39:40 tom Exp $
* $LynxId: HTAccess.c,v 1.78 2013/04/30 22:59:03 tom Exp $
*
* Access Manager HTAccess.c
* ==============
......@@ -858,7 +858,7 @@ static BOOL HTLoadDocument(const char *full_address, /* may include #fragment */
* (3) we are repositioning within the currently loaded document based
* on the target anchor's address (URL_Reference).
*
* If DONT_TRACK_INTERNAL_LINKS is defined, HText_AreDifferent() is
* If track_internal_links is false, HText_AreDifferent() is
* used to determine whether (3) applies. If the target address
* differs from that of the current document only by a fragment and the
* target address has an appended fragment, repositioning without
......@@ -873,7 +873,7 @@ static BOOL HTLoadDocument(const char *full_address, /* may include #fragment */
* (e.g., user requested RELOAD, or HTTP response with no-cache header
* and we are not overriding).
*
* If DONT_TRACK_INTERNAL_LINKS is undefined, a target address that
* If track_internal_links is true, a target address that
* points to the same URL as the current document may still result in
* reloading, depending on whether the original URL-Reference was given
* as an internal link in the context of the previously loaded
......@@ -897,14 +897,12 @@ static BOOL HTLoadDocument(const char *full_address, /* may include #fragment */
*/
if ((reloading != REAL_RELOAD) &&
(LYoverride_no_cache ||
#ifdef DONT_TRACK_INTERNAL_LINKS
!HText_hasNoCacheSet(text) ||
!HText_AreDifferent(anchor, full_address)
#else
((LYinternal_flag || !HText_hasNoCacheSet(text)) &&
!isLYNXIMGMAP(full_address))
#endif /* TRACK_INTERNAL_LINKS */
)) {
((!track_internal_links &&
(!HText_hasNoCacheSet(text) ||
!HText_AreDifferent(anchor, full_address))) ||
(track_internal_links &&
(((LYinternal_flag || !HText_hasNoCacheSet(text)) &&
!isLYNXIMGMAP(full_address))))))) {
CTRACE((tfp, "HTAccess: Document already in memory.\n"));
HText_select(text);
......
/*
* $LynxId: HTAnchor.c,v 1.71 2012/02/03 01:52:50 tom Exp $
* $LynxId: HTAnchor.c,v 1.74 2013/05/05 19:25:16 tom Exp $
*
* Hypertext "Anchor" Object HTAnchor.c
* ==========================
......@@ -319,68 +319,72 @@ HTChildAnchor *HTAnchor_findChildAndLink(HTParentAnchor *parent, /* May not be 0
(ltype == HTInternalLink) ? " (internal link)" : "",
NonNull(href)));
if (tag && *tag) {
child = HTAnchor_findNamedChild(parent->parent, tag);
if (parent == 0) {
child = 0;
} else {
child = HTAnchor_addChild(parent);
}
if (non_empty(tag)) {
child = HTAnchor_findNamedChild(parent->parent, tag);
} else {
child = HTAnchor_addChild(parent);
}
if (href && *href) {
const char *fragment = NULL;
HTParentAnchor0 *dest;
if (non_empty(href)) {
const char *fragment = NULL;
HTParentAnchor0 *dest;
if (ltype == HTInternalLink && *href == '#') {
dest = parent->parent;
} else {
const char *relative_to = ((parent->inBASE && *href != '#')
? parent->content_base
: parent->address);
DocAddress parsed_doc;
parsed_doc.address = HTParse(href, relative_to,
PARSE_ALL_WITHOUT_ANCHOR);
parsed_doc.post_data = NULL;
parsed_doc.post_content_type = NULL;
if (ltype && parent->post_data && ltype == HTInternalLink) {
/* for internal links, find a destination with the same
post data if the source of the link has post data. - kw
Example: LYNXIMGMAP: */
parsed_doc.post_data = parent->post_data;
parsed_doc.post_content_type = parent->post_content_type;
}
parsed_doc.bookmark = NULL;
parsed_doc.isHEAD = FALSE;
parsed_doc.safe = FALSE;
if (ltype == HTInternalLink && *href == '#') {
dest = parent->parent;
} else {
const char *relative_to = ((parent->inBASE && *href != '#')
? parent->content_base
: parent->address);
DocAddress parsed_doc;
parsed_doc.address = HTParse(href, relative_to,
PARSE_ALL_WITHOUT_ANCHOR);
parsed_doc.post_data = NULL;
parsed_doc.post_content_type = NULL;
if (ltype && parent->post_data && ltype == HTInternalLink) {
/* for internal links, find a destination with the same
post data if the source of the link has post data. - kw
Example: LYNXIMGMAP: */
parsed_doc.post_data = parent->post_data;
parsed_doc.post_content_type = parent->post_content_type;
}
parsed_doc.bookmark = NULL;
parsed_doc.isHEAD = FALSE;
parsed_doc.safe = FALSE;
dest = HTAnchor_findAddress_in_adult_table(&parsed_doc);
FREE(parsed_doc.address);
}
dest = HTAnchor_findAddress_in_adult_table(&parsed_doc);
FREE(parsed_doc.address);
}
/*
* [from HTAnchor_findAddress()]
* If the address represents a sub-anchor, we load its parent (above),
* then we create a named child anchor within that parent.
*/
fragment = (*href == '#') ? href + 1 : HTParseAnchor(href);
/*
* [from HTAnchor_findAddress()]
* If the address represents a sub-anchor, we load its parent (above),
* then we create a named child anchor within that parent.
*/
fragment = (*href == '#') ? href + 1 : HTParseAnchor(href);
if (*fragment)
dest = (HTParentAnchor0 *) HTAnchor_findNamedChild(dest, fragment);
if (*fragment)
dest = (HTParentAnchor0 *) HTAnchor_findNamedChild(dest, fragment);
if (tag && *tag) {
if (child->dest) { /* DUPLICATE_ANCHOR_NAME_WORKAROUND - kw */
CTRACE((tfp,
"*** Duplicate ChildAnchor %p named `%s'",
(void *) child, tag));
if ((HTAnchor *) dest != child->dest || ltype != child->type) {
if (tag && *tag) {
if (child->dest) { /* DUPLICATE_ANCHOR_NAME_WORKAROUND - kw */
CTRACE((tfp,
", different dest %p or type, creating unnamed child\n",
(void *) child->dest));
child = HTAnchor_addChild(parent);
"*** Duplicate ChildAnchor %p named `%s'",
(void *) child, tag));
if ((HTAnchor *) dest != child->dest || ltype != child->type) {
CTRACE((tfp,
", different dest %p or type, creating unnamed child\n",
(void *) child->dest));
child = HTAnchor_addChild(parent);
}
}
}
HTAnchor_link(child, (HTAnchor *) dest, ltype);
}
HTAnchor_link(child, (HTAnchor *) dest, ltype);
}
return child;
}
......@@ -774,7 +778,7 @@ static void HTParentAnchor_free(HTParentAnchor *me)
if ((fd = fopen(me->FileCache, "r")) != NULL) {
fclose(fd);
remove(me->FileCache);
(void) remove(me->FileCache);
}
FREE(me->FileCache);
}
......@@ -823,7 +827,7 @@ void HTAnchor_clearSourceCache(HTParentAnchor *me)
if (me->source_cache_file) {
CTRACE((tfp, "SourceCache: Removing file %s\n",
me->source_cache_file));
LYRemoveTemp(me->source_cache_file);
(void) LYRemoveTemp(me->source_cache_file);
FREE(me->source_cache_file);
}
if (me->source_cache_chunk) {
......
This diff is collapsed.
/*
* $LynxId: HTFile.c,v 1.132 2012/08/15 22:10:08 tom Exp $
* $LynxId: HTFile.c,v 1.136 2013/05/01 10:48:11 tom Exp $
*
* File Access HTFile.c
* ===========
......@@ -1169,10 +1169,10 @@ void LYGetFileInfo(const char *filename,
LYLocalFileToURL(&Aname, Afn);
file_anchor = HTAnchor_findSimpleAddress(Aname);
file_csname = file_anchor->charset;
format = HTFileFormat(filename, &myEnc, pdesc);
format = HTCharsetFormat(format, file_anchor, UCLYhndl_HTFile_for_unspec);
file_cs = HTAnchor_getUCLYhndl(file_anchor, UCT_STAGE_MIME);
file_csname = file_anchor->charset;
if (!file_csname) {
if (file_cs >= 0)
file_csname = LYCharSet_UC[file_cs].MIMEname;
......@@ -2289,12 +2289,14 @@ static BOOL sniffStream(FILE *fp, char *buffer, size_t needed)
long offset = ftell(fp);
BOOL result = FALSE;
if (fread(buffer, sizeof(char), needed, fp) == needed) {
result = TRUE;
}
if (fseek(fp, offset, SEEK_SET) < 0) {
CTRACE((tfp, "error seeking in stream\n"));
result = FALSE;
if (offset >= 0) {
if (fread(buffer, sizeof(char), needed, fp) == needed) {
result = TRUE;
}
if (fseek(fp, offset, SEEK_SET) < 0) {
CTRACE((tfp, "error seeking in stream\n"));
result = FALSE;
}
}
return result;
}
......@@ -2385,6 +2387,7 @@ static int decompressAndParse(HTParentAnchor *anchor,
char *localname = filename;
int bin;
FILE *fp;
int result = FALSE;
#ifdef VMS
/*
......@@ -2443,6 +2446,7 @@ static int decompressAndParse(HTParentAnchor *anchor,
if (isDOWNLOAD(cftGzip)) {
if (isGzipStream(fp)) {
fclose(fp);
fp = 0;
gzfp = gzopen(localname, BIN_R);
CTRACE((tfp, "HTLoadFile: gzopen of `%s' gives %p\n",
......@@ -2464,6 +2468,7 @@ static int decompressAndParse(HTParentAnchor *anchor,
if (isDOWNLOAD(cftBzip2)) {
if (isBzip2Stream(fp)) {
fclose(fp);
fp = 0;
bzfp = BZ2_bzopen(localname, BIN_R);
CTRACE((tfp, "HTLoadFile: bzopen of `%s' gives %p\n",
......@@ -2520,6 +2525,7 @@ static int decompressAndParse(HTParentAnchor *anchor,
if (strcmp(format_out->name, "www/download") != 0) {
if (isGzipStream(fp)) {
fclose(fp);
fp = 0;
gzfp = gzopen(localname, BIN_R);
CTRACE((tfp, "HTLoadFile: gzopen of `%s' gives %p\n",
......@@ -2537,6 +2543,7 @@ static int decompressAndParse(HTParentAnchor *anchor,
if (strcmp(format_out->name, "www/download") != 0) {
if (isBzip2Stream(fp)) {
fclose(fp);
fp = 0;
bzfp = BZ2_bzopen(localname, BIN_R);
CTRACE((tfp, "HTLoadFile: bzopen of `%s' gives %p\n",
......@@ -2621,11 +2628,14 @@ static int decompressAndParse(HTParentAnchor *anchor,
#endif /* USE_ZLIB || USE_BZLIB */
{
*statusp = HTParseFile(format, format_out, anchor, fp, sink);
}
if (fp != 0) {
fclose(fp);
fp = 0;
}
return TRUE;
result = TRUE;
} /* If successful open */
return FALSE;
return result;
}
/* Load a document.
......@@ -2871,22 +2881,22 @@ int HTLoadFile(const char *addr,
FREE(cp);
value = HTStackValue(format, format_out,
filevalue, 0L);
switch (cft) {
case cftCompress:
atomname = "application/x-compressed";
break;
case cftGzip:
atomname = "application/x-gzip";
break;
case cftDeflate:
atomname = "application/x-deflate";
break;
case cftBzip2:
atomname = "application/x-bzip2";
break;
case cftNone:
break;
}
}
switch (cft) {
case cftCompress:
atomname = "application/x-compressed";
break;
case cftGzip:
atomname = "application/x-gzip";
break;
case cftDeflate:
atomname = "application/x-deflate";
break;
case cftBzip2:
atomname = "application/x-bzip2";
break;
case cftNone:
break;
}
if (atomname != NULL) {
......
/*
* $LynxId: HTFinger.c,v 1.29 2011/05/24 09:21:13 tom Exp $
* $LynxId: HTFinger.c,v 1.30 2013/01/04 21:40:19 tom Exp $
*
* FINGER ACCESS HTFinger.c
* =============
......@@ -163,11 +163,7 @@ static int response(char *command,
PUTS(sitename);
END(HTML_EM);
PUTS(": ");
if (command) {
StrAllocCopy(cmd, command);
} else {
StrAllocCopy(cmd, "");
}
StrAllocCopy(cmd, command);
for (i = ((int) strlen(cmd) - 1); i >= 0; i--) {
if (cmd[i] == LF || cmd[i] == CR) {
cmd[i] = '\0';
......
This diff is collapsed.
/*
* $LynxId: HTGopher.c,v 1.56 2012/11/17 01:33:36 tom Exp $
* $LynxId: HTGopher.c,v 1.60 2013/05/01 22:20:13 tom Exp $
*
* GOPHER ACCESS HTGopher.c
* =============
......@@ -742,6 +742,7 @@ static void free_CSOfields(void)
*/
static void interpret_cso_key(const char *key,
char *buf,
size_t bufsize,
int *length,
CSOformgen_context * ctx,
HTStream *Target)
......@@ -856,7 +857,7 @@ static void interpret_cso_key(const char *key,
while (*key && (*key != ')')) {
buf[out++] = (*key++);
if (out > sizeof(buf) - 2) {
if (out > bufsize - 2) {
buf[out] = '\0';
(*Target->isa->put_block) (Target, buf, (int) strlen(buf));
out = 0;
......@@ -1087,6 +1088,7 @@ static int parse_cso_fields(char *buf,
static int generate_cso_form(char *host,
int port,
char *buf,
size_t bufsize,
HTStream *Target)
{
int i, j, length;
......@@ -1136,9 +1138,7 @@ static int generate_cso_form(char *host,
*/
out = 0;
buf[out] = '\0';
for (i = full_flag ? /***1***/ 0 : 0;
ctemplate[i];
i++) {
for (i = 0; ctemplate[i]; i++) {
/*
* Search the current string for substitution, flagged by $(
*/
......@@ -1159,7 +1159,7 @@ static int generate_cso_form(char *host,
*/
ctx.cur_line = i;
ctx.cur_off = j;
interpret_cso_key(key, buf, &length, &ctx, Target);
interpret_cso_key(key, buf, bufsize, &length, &ctx, Target);
i = ctx.cur_line;
j = ctx.cur_off;
line = ctemplate[i];
......@@ -1202,7 +1202,7 @@ static int generate_cso_form(char *host,
* Non-command text, add to output buffer.
*/
buf[out++] = line[j];
if (out > (sizeof(buf) - 3)) {
if (out > (bufsize - 3)) {
buf[out] = '\0';
(*Target->isa->put_block) (Target, buf, (int) strlen(buf));
out = 0;
......@@ -1421,7 +1421,7 @@ static int generate_cso_report(HTStream *Target)
(*Target->isa->put_block) (Target, buf, (int) strlen(buf));
}
} else {
HTSprintf0(&buf, "<DD>%s\n", fname ? fname : rcode);
HTSprintf0(