summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/curl/curl/CVE-2023-32001.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/curl/curl/CVE-2023-32001.patch')
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-32001.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/meta/recipes-support/curl/curl/CVE-2023-32001.patch b/meta/recipes-support/curl/curl/CVE-2023-32001.patch
new file mode 100644
index 0000000000..f533992bcd
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-32001.patch
@@ -0,0 +1,38 @@
1From 0c667188e0c6cda615a036b8a2b4125f2c404dde Mon Sep 17 00:00:00 2001
2From: SaltyMilk <soufiane.elmelcaoui@gmail.com>
3Date: Mon, 10 Jul 2023 21:43:28 +0200
4Subject: [PATCH] fopen: optimize
5
6Closes #11419
7
8Upstream-Status: Backport [https://github.com/curl/curl/commit/0c667188e0c6cda615a036b8a2b4125f2c404dde]
9CVE: CVE-2023-32001
10Signed-off-by: Ashish Sharma <asharma@mvista.com>
11
12 lib/fopen.c | 12 ++++++------
13 1 file changed, 6 insertions(+), 6 deletions(-)
14
15diff --git a/lib/fopen.c b/lib/fopen.c
16index c9c9e3d6e73a2..b6e3cadddef65 100644
17--- a/lib/fopen.c
18+++ b/lib/fopen.c
19@@ -56,13 +56,13 @@ CURLcode Curl_fopen(struct Curl_easy *data, const char *filename,
20 int fd = -1;
21 *tempname = NULL;
22
23- if(stat(filename, &sb) == -1 || !S_ISREG(sb.st_mode)) {
24- /* a non-regular file, fallback to direct fopen() */
25- *fh = fopen(filename, FOPEN_WRITETEXT);
26- if(*fh)
27- return CURLE_OK;
28+ *fh = fopen(filename, FOPEN_WRITETEXT);
29+ if(!*fh)
30 goto fail;
31- }
32+ if(fstat(fileno(*fh), &sb) == -1 || !S_ISREG(sb.st_mode))
33+ return CURLE_OK;
34+ fclose(*fh);
35+ *fh = NULL;
36
37 result = Curl_rand_hex(data, randsuffix, sizeof(randsuffix));
38 if(result)