Compare commits
No commits in common. 'c9' and 'c8-beta' have entirely different histories.
@ -1,57 +0,0 @@
|
|||||||
From 4bbfd43121e4c1f59074b1b0def9804c1890b2dc Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jan Macku <jamacku@redhat.com>
|
|
||||||
Date: Mon, 19 Jul 2021 09:48:19 +0200
|
|
||||||
Subject: [PATCH] review of CWE-170, CWE-772
|
|
||||||
|
|
||||||
Resolves: #1938887
|
|
||||||
---
|
|
||||||
libsupp/clif.c | 2 ++
|
|
||||||
traceroute/traceroute.c | 7 ++++++-
|
|
||||||
2 files changed, 8 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/libsupp/clif.c b/libsupp/clif.c
|
|
||||||
index 4ef20e4..60ec291 100644
|
|
||||||
--- a/libsupp/clif.c
|
|
||||||
+++ b/libsupp/clif.c
|
|
||||||
@@ -229,10 +229,12 @@ static void err_bad_arg (const CLIF_option *optn, char c, int n) {
|
|
||||||
|
|
||||||
if (c) {
|
|
||||||
s = show_short (&tmp); /* always without arg... */
|
|
||||||
+ /* coverity[buffer_size_warning] - not a bug, s ends with '\0', see line 97 */
|
|
||||||
strncpy (ss, s, sizeof (ss));
|
|
||||||
s = show_short (optn);
|
|
||||||
} else {
|
|
||||||
s = show_long (&tmp); /* always without arg... */
|
|
||||||
+ /* coverity[buffer_size_warning] - not a bug, s ends with '\0', see line 97 */
|
|
||||||
strncpy (ss, s, sizeof (ss));
|
|
||||||
s = show_long (optn);
|
|
||||||
}
|
|
||||||
diff --git a/traceroute/traceroute.c b/traceroute/traceroute.c
|
|
||||||
index 4be9b24..0a29e36 100644
|
|
||||||
--- a/traceroute/traceroute.c
|
|
||||||
+++ b/traceroute/traceroute.c
|
|
||||||
@@ -217,8 +217,12 @@ static int getaddr (const char *name, sockaddr_any *addr) {
|
|
||||||
}
|
|
||||||
if (!ai) ai = res; /* anything... */
|
|
||||||
|
|
||||||
- if (ai->ai_addrlen > sizeof (*addr))
|
|
||||||
+ if (ai->ai_addrlen > sizeof (*addr)) {
|
|
||||||
+ /* Avoid of leaking res (CWE-772) */
|
|
||||||
+ freeaddrinfo (res);
|
|
||||||
return -1; /* paranoia */
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
memcpy (addr, ai->ai_addr, ai->ai_addrlen);
|
|
||||||
|
|
||||||
freeaddrinfo (res);
|
|
||||||
@@ -244,6 +248,7 @@ static void make_fd_used (int fd) {
|
|
||||||
close (nfd);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ /* coverity[leaked_handle] - not a bug, see line 665 */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.31.1
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
|||||||
|
From 9a605da8a6c72f0f52f505f38adb3133b7e726f8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Macku <jamacku@redhat.com>
|
||||||
|
Date: Mon, 30 Oct 2023 12:55:43 +0100
|
||||||
|
Subject: [PATCH] Fix command line parsing in wrappers
|
||||||
|
|
||||||
|
Resolves: CVE-2023-46316
|
||||||
|
---
|
||||||
|
wrappers/tcptraceroute | 2 +-
|
||||||
|
wrappers/tracepath | 2 +-
|
||||||
|
wrappers/traceproto | 2 +-
|
||||||
|
wrappers/traceroute-nanog | 2 +-
|
||||||
|
4 files changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/wrappers/tcptraceroute b/wrappers/tcptraceroute
|
||||||
|
index b4fc810..9063886 100755
|
||||||
|
--- a/wrappers/tcptraceroute
|
||||||
|
+++ b/wrappers/tcptraceroute
|
||||||
|
@@ -26,7 +26,7 @@ usage () {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-PARSED=`getopt 'hvdnNi:l:f:Fm:p:q:w:s:t:SAE' "$@"`
|
||||||
|
+PARSED=`getopt -- 'hvdnNi:l:f:Fm:p:q:w:s:t:SAE' "$@"`
|
||||||
|
[ $? != 0 ] && exit 2
|
||||||
|
|
||||||
|
eval set -- "$PARSED"
|
||||||
|
diff --git a/wrappers/tracepath b/wrappers/tracepath
|
||||||
|
index 987b998..448f031 100755
|
||||||
|
--- a/wrappers/tracepath
|
||||||
|
+++ b/wrappers/tracepath
|
||||||
|
@@ -25,7 +25,7 @@ usage () {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-PARSED=`getopt 'hnbl:' "$@"`
|
||||||
|
+PARSED=`getopt -- 'hnbl:' "$@"`
|
||||||
|
[ $? != 0 ] && exit 2
|
||||||
|
|
||||||
|
eval set -- "$PARSED"
|
||||||
|
diff --git a/wrappers/traceproto b/wrappers/traceproto
|
||||||
|
index 988fdc5..5dfd9a7 100755
|
||||||
|
--- a/wrappers/traceproto
|
||||||
|
+++ b/wrappers/traceproto
|
||||||
|
@@ -38,7 +38,7 @@ warning () {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-PARSED=`getopt 'cCTfAhvRp:d:D:s:S:m:M:w:W:a:P:F:k:I:H:i:o:t:' "$@"`
|
||||||
|
+PARSED=`getopt -- 'cCTfAhvRp:d:D:s:S:m:M:w:W:a:P:F:k:I:H:i:o:t:' "$@"`
|
||||||
|
[ $? != 0 ] && exit 2
|
||||||
|
|
||||||
|
eval set -- "$PARSED"
|
||||||
|
diff --git a/wrappers/traceroute-nanog b/wrappers/traceroute-nanog
|
||||||
|
index 29fd2a4..aac4c83 100755
|
||||||
|
--- a/wrappers/traceroute-nanog
|
||||||
|
+++ b/wrappers/traceroute-nanog
|
||||||
|
@@ -31,7 +31,7 @@ warning () {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-PARSED=`getopt 'adnruvAMOPQU$w:S:m:p:q:g:t:s:I:f:T:' "$@"`
|
||||||
|
+PARSED=`getopt -- 'adnruvAMOPQU$w:S:m:p:q:g:t:s:I:f:T:' "$@"`
|
||||||
|
[ $? != 0 ] && {
|
||||||
|
usage
|
||||||
|
exit 2
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
Loading…
Reference in new issue