NetBSD Problem Report #60930
From www@netbsd.org Tue Oct 27 06:53:04 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.netbsd.org", Issuer "YR1" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 9694E1A923B
for <gnats-bugs@gnats.NetBSD.org>; Tue, 27 Oct 2026 06:53:04 +0000 (UTC)
Message-Id: <20261027065303.5D69D1A923C@mollari.NetBSD.org>
Date: Tue, 27 Oct 2026 06:53:03 +0000 (UTC)
From: netbsd@linear.network
Reply-To: netbsd@linear.network
To: gnats-bugs@NetBSD.org
Subject: ftp with file:/// uri fails, ftp_strdup: called with NULL argument
X-Send-Pr-Version: www-1.0
X-From4GNATS: "netbsd@linear.network via gnats" <gnats-admin@NetBSD.org>
>Number: 60930
>Category: bin
>Synopsis: ftp with file:/// uri fails, ftp_strdup: called with NULL argument
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Oct 27 06:55:00 +0000 2026
>Last-Modified: Tue Oct 27 09:50:01 +0000 2026
>Originator: linear
>Release: 11.0
>Organization:
>Environment:
NetBSD dreamcast 11.0 NetBSD 11.0 (GENERIC) #0: Thu Jul 30 15:23:12 UTC 2026 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/dreamcast/compile/GENERIC dreamcast
>Description:
the ftp program is documented in its man page as supporting file:// uri for obtaining files.
however, when attempting to use that functionality, the following error is produced:
ftp: ftp_strdup: called with NULL argument
>How-To-Repeat:
attempt to fetch a file from the local filesystem using the ftp program, using a file:// uri:
$ ftp ftp:///netbsd
ftp: ftp_strdup: called with NULL argument
$ ftp ftp:///etc/profile
ftp: ftp_strdup: called with NULL argument
>Fix:
>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/60930: ftp with file:/// uri fails, ftp_strdup: called with
NULL argument
Date: Tue, 27 Oct 2026 10:03:01 +0100
(gdb) break errx
Breakpoint 2 at 0xf73433cc: file /work/src/lib/libc/gen/errx.c, line 56.
(gdb) run
Starting program: /usr/bin/ftp file:///netbsd
Breakpoint 2, _errx (eval=eval@entry=1,
fmt=fmt@entry=0x961d734 "ftp_strdup: called with NULL argument")
at /work/src/lib/libc/gen/errx.c:56
warning: 56 /work/src/lib/libc/gen/errx.c: No such file or directory
(gdb) bt
#0 _errx (eval=eval@entry=1,
fmt=fmt@entry=0x961d734 "ftp_strdup: called with NULL argument")
at /work/src/lib/libc/gen/errx.c:56
#1 0x096156d4 in ftp_strdup (str=str@entry=0x0)
at /work/src/usr.bin/ftp/util.c:1602
#2 0x0960518c in copyurlinfo (dui=0xfffce370, sui=0xfffce35c)
at /work/src/usr.bin/ftp/fetch.c:240
#3 fetch_url (url=0xfffcf781 "file:///netbsd", proxyenv=<optimized out>,
proxyauth=0x0, wwwauth=0x0, rui=0x0) at /work/src/usr.bin/ftp/fetch.c:1460
#4 0x0960801c in auto_fetch (argc=1, argv=0xfffcf248)
at /work/src/usr.bin/ftp/fetch.c:2421
#5 0x09617a0c in main (argc=<optimized out>, argv=<optimized out>)
at /work/src/usr.bin/ftp/main.c:550
(gdb) up 2
#2 0x0960518c in copyurlinfo (dui=0xfffce370, sui=0xfffce35c)
at /work/src/usr.bin/ftp/fetch.c:240
warning: 240 /work/src/usr.bin/ftp/fetch.c: No such file or directory
(gdb) p *sui
$1 = {host = 0x0, port = 0xf5c580f0 "", path = 0xf5c580e8 "/netbsd",
utype = FILE_URL_T, portnum = 0}
(gdb) p *dui
$2 = {host = 0x0, port = 0x0, path = 0x0, utype = UNKNOWN_URL_T, portnum = 0}
I guess the three ftp_strdup in that function should all be replaced
by an if testing for NULL and setting the target to NULL in that case.
Martin
From: RVP <rvp@SDF.ORG>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/60930: ftp with file:/// uri fails, ftp_strdup: called with
NULL argument
Date: Tue, 27 Oct 2026 09:49:37 +0000 (UTC)
On Tue, 27 Oct 2026, netbsd@linear.network via gnats wrote:
>> Description:
> the ftp program is documented in its man page as supporting file:// uri for obtaining files.
>
> however, when attempting to use that functionality, the following error is produced:
>
> ftp: ftp_strdup: called with NULL argument
>
>> How-To-Repeat:
> attempt to fetch a file from the local filesystem using the ftp program, using a file:// uri:
>
> $ ftp ftp:///netbsd
> ftp: ftp_strdup: called with NULL argument
>
Try:
```
--- src/usr.bin/ftp/fetch.c.orig 2026-07-20 04:05:14.623169837 +0000
+++ src/usr.bin/ftp/fetch.c 2026-10-27 09:41:19.950487587 +0000
@@ -579,7 +579,7 @@
#endif /* INET6 */
if ((cp = strchr(thost, ':')) != NULL)
*cp++ = '\0';
- if (*thost != '\0')
+ // if (*thost != '\0')
ui->host = thost;
/* look for [:port] */
```
-RVP
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.