mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-28 02:40:50 +00:00
curl: apply patch for CVE-2023-32001
https://curl.se/docs/CVE-2023-32001.html
This commit is contained in:
34
pkgs/tools/networking/curl/CVE-2023-32001.patch
Normal file
34
pkgs/tools/networking/curl/CVE-2023-32001.patch
Normal file
@@ -0,0 +1,34 @@
|
||||
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 c9c9e3d6e73a2..b6e3cadddef65 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)
|
||||
@@ -59,6 +59,9 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
patches = [
|
||||
./7.79.1-darwin-no-systemconfiguration.patch
|
||||
|
||||
# Affected versions: 7.84.0 to and including 8.1.2
|
||||
./CVE-2023-32001.patch
|
||||
];
|
||||
|
||||
outputs = [ "bin" "dev" "out" "man" "devdoc" ];
|
||||
|
||||
Reference in New Issue
Block a user