--- lynx2-8-4/src/LYCgi.c.CVE-2005-2929	2001-02-09 02:50:00.000000000 +0000
+++ lynx2-8-4/src/LYCgi.c	2005-11-11 18:44:02.000000000 +0000
@@ -140,6 +140,40 @@
     }
 }
 
+#ifdef LYNXCGI_LINKS
+/*
+ * Wrapper for exec_ok(), confirming with user if the link text is not visible
+ * in the status line.
+ */
+static BOOL can_exec_cgi(const char *linktext, const char *linkargs)
+{
+    const char *format = gettext("Do you want to execute \"%s\"?");
+    char *message = NULL;
+    char *command = NULL;
+    char *p;
+    BOOL result = TRUE;
+
+    if (!exec_ok(HTLoadedDocumentURL(), linktext, CGI_PATH)) {
+	/* exec_ok gives out msg. */
+	result = FALSE;
+    } else if (user_mode < ADVANCED_MODE) {
+	StrAllocCopy(command, linktext);
+	if (non_empty(linkargs)) {
+	    HTSprintf(&command, " %s", linkargs);
+	}
+	HTUnEscape(command);
+	for (p = command; *p; ++p)
+	    if (*p == '+')
+		*p = ' ';
+	HTSprintf0(&message, format, command);
+	result = HTConfirm(message);
+	FREE(message);
+	FREE(command);
+    }
+    return result;
+}
+#endif /* LYNXCGI_LINKS */
+
 PRIVATE int LYLoadCGI ARGS4(
 	CONST char *, 		arg,
 	HTParentAnchor *,	anAnchor,
@@ -272,8 +306,7 @@
 	       strcmp(arg, HTLoadedDocumentURL()) &&
 	       HText_AreDifferent(anAnchor, arg) &&
 	       HTUnEscape(orig_pgm) &&
-	       !exec_ok(HTLoadedDocumentURL(), orig_pgm,
-			CGI_PATH)) { /* exec_ok gives out msg. */
+	       !can_exec_cgi(orig_pgm, "")) {
 	/*
 	 *  If we have extra path info and are not just reloading
 	 *  the current, check the full file path (after unescaping)
@@ -304,8 +337,7 @@
 	       !(reloading && anAnchor->document) &&
 	       strcmp(arg, HTLoadedDocumentURL()) &&
 	       HText_AreDifferent(anAnchor, arg) &&
-	       !exec_ok(HTLoadedDocumentURL(), pgm,
-			CGI_PATH)) { /* exec_ok gives out msg. */
+	       !can_exec_cgi(pgm, pgm_args)) {
 	/*
 	 *  If we are reloading a lynxcgi document that had already been
 	 *  loaded, the various checks above should allow it even if
--- lynx2-8-4/src/LYGetFile.c.CVE-2005-2929	2001-02-27 02:41:57.000000000 +0000
+++ lynx2-8-4/src/LYGetFile.c	2005-11-11 18:44:02.000000000 +0000
@@ -1487,6 +1487,8 @@
 	    if (strstr(command,"//") == linktext) {
 		command += 2;
 	    }
+	    CTRACE((tfp, "comparing source\n\t'%s'\n\t'%s'\n", source, tp->src));
+	    CTRACE((tfp, "comparing command\n\t'%s'\n\t'%s'\n", command, tp->path));
 	    if (STRNADDRCOMP(source, tp->src, strlen(tp->src)) == 0 &&
 		STRNADDRCOMP(command, tp->path, strlen(tp->path)) == 0)
 		return TRUE;
--- lynx2-8-4/CHANGES.CVE-2005-2929	2005-11-11 18:43:29.000000000 +0000
+++ lynx2-8-4/CHANGES	2005-11-11 18:44:22.000000000 +0000
@@ -3,6 +3,13 @@
 * eliminate fixed-size buffers in HTrjis() and related functions to avoid
   potential buffer overflow in nntp pages (report by Ulf Harnhammar) -TD
 
+2005-10-30 (2.8.6dev.15)
+* modify LYLoadCGI() to prompt user, displaying the command that would be
+  executed, to confirm that it should be.  This makes it easier to notice when
+  a local program would be run by activating a lynxcgi link.  This is not done
+  in advanced mode, since the URL is already visible in the status line (report
+  by vade79, comments by Greg MacManus) -TD
+
 2001-07-17 (2.8.4rel.1)
 extracted from 2002-08-14 (2.8.5dev.9)
 * escape blanks and other non-7bit graphic characters in startfile and similar
--- lynx2-8-4/src/LYStrings.h.CVE-2005-2929	2005-11-11 18:51:01.000000000 +0000
+++ lynx2-8-4/src/LYStrings.h	2005-11-11 18:51:45.000000000 +0000
@@ -76,6 +76,8 @@
 	int *		nstartp,
 	int *		nendp));
 
+#define non_empty(s) ((s) != NULL && *(s) != '\0')
+
 #define LYno_attr_mb_strstr(chptr, tarptr, utf_flag, count_gcells, nstartp, nendp) \
 	(case_sensitive \
 	    ? LYno_attr_mbcs_strstr(chptr, tarptr, utf_flag, count_gcells, nstartp, nendp) \
