]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ftplistparser: clear strings.target if not symlink master
authorDaniel Stenberg <daniel@haxx.se>
Sat, 6 Jun 2026 21:38:22 +0000 (23:38 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 6 Jun 2026 22:26:51 +0000 (00:26 +0200)
When the struct is passed to the CURLOPT_CHUNK_BGN_FUNCTION callback,
clear the pointer if the provided data is not a symlink.

Closes #21884

lib/ftplistparser.c

index 0c8cea4dc90b53599ec7bf6c92f8ba32e7fa9ee4..a4fffc86dc84d083e09d2a1c8ff7d364109ff8a4 100644 (file)
@@ -310,8 +310,9 @@ static CURLcode ftp_pl_insert_finfo(struct Curl_easy *data,
                           str + parser->offsets.group : NULL;
   finfo->strings.perm   = parser->offsets.perm ?
                           str + parser->offsets.perm : NULL;
-  finfo->strings.target = parser->offsets.symlink_target ?
-                          str + parser->offsets.symlink_target : NULL;
+  finfo->strings.target = parser->offsets.symlink_target &&
+    (finfo->filetype == CURLFILETYPE_SYMLINK) ?
+    str + parser->offsets.symlink_target : NULL;
   finfo->strings.time   = str + parser->offsets.time;
   finfo->strings.user   = parser->offsets.user ?
                           str + parser->offsets.user : NULL;