summaryrefslogtreecommitdiff
path: root/backport-CVE-2023-32001.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-09-01 06:42:04 +0000
committerCoprDistGit <infra@openeuler.org>2023-09-01 06:42:04 +0000
commited3c4fc2f8de47a3c5342e37b70595b49132e0f7 (patch)
treeaf043e85653b53fe1ea8f3f1962f3c67eb2a6ebe /backport-CVE-2023-32001.patch
parent320b46bd46465c1056724bcadbf6c12539f849c4 (diff)
Diffstat (limited to 'backport-CVE-2023-32001.patch')
-rw-r--r--backport-CVE-2023-32001.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/backport-CVE-2023-32001.patch b/backport-CVE-2023-32001.patch
new file mode 100644
index 0000000..8827596
--- /dev/null
+++ b/backport-CVE-2023-32001.patch
@@ -0,0 +1,37 @@
+From 0c667188e0c6cda615a036b8a2b4125f2c404dde Mon Sep 17 00:00:00 2001
+From: SaltyMilk <soufiane.elmelcaoui@gmail.com>
+Date: Mon, 10 Jul 2023 21:43:28 +0200
+Subject: [PATCH] fopen: optimize
+
+Closes #11419
+---
+ lib/fopen.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/lib/fopen.c b/lib/fopen.c
+index c9c9e3d6e..b6e3caddd 100644
+--- a/lib/fopen.c
++++ b/lib/fopen.c
+@@ -56,13 +56,13 @@ CURLcode Curl_fopen(struct Curl_easy *data, const char *filename,
+ int fd = -1;
+ *tempname = NULL;
+
+- if(stat(filename, &sb) == -1 || !S_ISREG(sb.st_mode)) {
+- /* a non-regular file, fallback to direct fopen() */
+- *fh = fopen(filename, FOPEN_WRITETEXT);
+- if(*fh)
+- return CURLE_OK;
++ *fh = fopen(filename, FOPEN_WRITETEXT);
++ if(!*fh)
+ goto fail;
+- }
++ if(fstat(fileno(*fh), &sb) == -1 || !S_ISREG(sb.st_mode))
++ return CURLE_OK;
++ fclose(*fh);
++ *fh = NULL;
+
+ result = Curl_rand_hex(data, randsuffix, sizeof(randsuffix));
+ if(result)
+--
+2.33.0
+