mirror of
git://slackware.nl/current.git
synced 2024-12-28 09:59:53 +01:00
a9219aba34
a/less-653-x86_64-2.txz: Rebuilt. This update patches a security issue: less through 653 allows OS command execution via a newline character in the name of a file, because quoting is mishandled in filename.c. Exploitation typically requires use with attacker-controlled file names, such as the files extracted from an untrusted archive. Exploitation also requires the LESSOPEN environment variable, but this is set by default in many common cases. For more information, see: https://www.cve.org/CVERecord?id=CVE-2024-32487 (* Security fix *) ap/inxi-3.3.34_1-noarch-1.txz: Upgraded. d/python-setuptools-69.5.1-x86_64-1.txz: Upgraded. n/bluez-5.74-x86_64-1.txz: Upgraded. xfce/xfce4-notifyd-0.9.4-x86_64-1.txz: Upgraded. Almost everyone has jumped to this version, so we'll get with the program.
73 lines
1.7 KiB
Diff
73 lines
1.7 KiB
Diff
From 007521ac3c95bc76e3d59c6dbfe75d06c8075c33 Mon Sep 17 00:00:00 2001
|
|
From: Mark Nudelman <markn@greenwoodsoftware.com>
|
|
Date: Thu, 11 Apr 2024 17:49:48 -0700
|
|
Subject: [PATCH] Fix bug when viewing a file whose name contains a newline.
|
|
|
|
---
|
|
filename.c | 31 +++++++++++++++++++++++++------
|
|
1 file changed, 25 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/filename.c b/filename.c
|
|
index f90e0e82..a52c6354 100644
|
|
--- a/filename.c
|
|
+++ b/filename.c
|
|
@@ -127,11 +127,20 @@ static constant char * metachars(void)
|
|
/*
|
|
* Is this a shell metacharacter?
|
|
*/
|
|
-static int metachar(char c)
|
|
+static lbool metachar(char c)
|
|
{
|
|
return (strchr(metachars(), c) != NULL);
|
|
}
|
|
|
|
+/*
|
|
+ * Must use quotes rather than escape char for this metachar?
|
|
+ */
|
|
+static lbool must_quote(char c)
|
|
+{
|
|
+ /* {{ Maybe the set of must_quote chars should be configurable? }} */
|
|
+ return (c == '\n');
|
|
+}
|
|
+
|
|
/*
|
|
* Insert a backslash before each metacharacter in a string.
|
|
*/
|
|
@@ -164,6 +173,9 @@ public char * shell_quoten(constant char *s, size_t slen)
|
|
* doesn't support escape chars. Use quotes.
|
|
*/
|
|
use_quotes = TRUE;
|
|
+ } else if (must_quote(*p))
|
|
+ {
|
|
+ len += 3; /* open quote + char + close quote */
|
|
} else
|
|
{
|
|
/*
|
|
@@ -194,15 +206,22 @@ public char * shell_quoten(constant char *s, size_t slen)
|
|
constant char *es = s + slen;
|
|
while (s < es)
|
|
{
|
|
- if (metachar(*s))
|
|
+ if (!metachar(*s))
|
|
{
|
|
- /*
|
|
- * Add the escape char.
|
|
- */
|
|
+ *np++ = *s++;
|
|
+ } else if (must_quote(*s))
|
|
+ {
|
|
+ /* Surround the char with quotes. */
|
|
+ *np++ = openquote;
|
|
+ *np++ = *s++;
|
|
+ *np++ = closequote;
|
|
+ } else
|
|
+ {
|
|
+ /* Insert an escape char before the char. */
|
|
strcpy(np, esc);
|
|
np += esclen;
|
|
+ *np++ = *s++;
|
|
}
|
|
- *np++ = *s++;
|
|
}
|
|
*np = '\0';
|
|
}
|