From 317bf7e8a8e71b60753a1efacfa323695431bd4e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 6 Jun 2026 23:38:22 +0200 Subject: [PATCH] ftplistparser: clear strings.target if not symlink 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ftplistparser.c b/lib/ftplistparser.c index 0c8cea4dc9..a4fffc86dc 100644 --- a/lib/ftplistparser.c +++ b/lib/ftplistparser.c @@ -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; -- 2.47.3