delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/04/29/02:20:28

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 53T6KR6Q1296430
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 53T6KR6Q1296430
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=RR0y8bky
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D03F53857C6C
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1745907626;
bh=SV8JTywntoR9Wmjo8ibfatgFpL+sbVl5mjt8HBDjpDs=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=RR0y8bky798fhw0PN4aCUDvM0Dm1ricTycW0sgZoz5dMz0eKHYYDxsrtQCibsk2pp
ZTa8+hHtSfr8RUyrz/R5TQIUw5DygZacnRbvZ1sX8baI44vCYfqWUejbeMV7o0QGLR
w66J3Xq/32Q0UFQPW3hZU79QkNddoby+CbD0zmcA=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B2C75385840F
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B2C75385840F
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1745907500; cv=none;
b=sDwGSL8/QlVd9QmxpuAWKiLrE0vNaHq9tfTrVUs3v6i37/SMCfs4xcGwmLK+bLrr5qUZwzw3XxrK8kTpTm0oHFBb0qrtDQtSz8BsjPnoJgX6m//kc51+RwCsRXTfkqARdy9V4PmH3y5DUbhB22FOVPBZ+NziLHz75s/S5ihBWVg=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1745907500; c=relaxed/simple;
bh=NuPOsFDdIDazohiJCKQISXcPGwnix1FpT4zL6yeXm6g=;
h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;
b=lpP/pKxokwg9Zeq66u9t3aQh9Gk/QDZItsfB3eL4jGAL2r1GH5hTe5RkeTpbA3MM1/olsG+ak/M7bK3q/Li4tfxW8UMW0+CUWZDShLuCnDRvnb0N32aWs/j5nW2FHnaE2S51u4U+QFKCuR/1lCLaP+O42aZRS1Iwrbdm+agkNJM=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B2C75385840F
Date: Mon, 28 Apr 2025 23:18:20 -0700 (PDT)
X-X-Sender: jeremyd AT resin DOT csoft DOT net
To: cygwin AT cygwin DOT com
Subject: Re: cygwin_conv_path with size 0
In-Reply-To: <9c8107b6-a040-d956-2590-ede1517bc2ad@jdrake.com>
Message-ID: <e0ec0fd8-9c43-9e9d-ba02-5aa2e0f8a014@jdrake.com>
References: <9c8107b6-a040-d956-2590-ede1517bc2ad AT jdrake DOT com>
MIME-Version: 1.0
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Jeremy Drake via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Jeremy Drake <cygwin AT jdrake DOT com>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

On Mon, 28 Apr 2025, Jeremy Drake via Cygwin wrote:

> I was just describing cygwin_conv_path on a rust issue
> (https://github.com/rust-lang/backtrace-rs/pull/704).  I was saying that
> the pointer `to` is not accessed when `size` is 0, but it turns out on
> circa line 4022 in path.cc
>
> to = (void *) wcpcpy ((wchar_t *) to, ro_u_globalroot.Buffer);
>
> This is before `size` is checked and lsiz returned if it was zero, or
> ENOSPC set if size is too small, circa line 4060.  This seems like a bug
> to me.

Yep, test case

#include <stdio.h>
#include <sys/cygwin.h>

int main(void)
{
  wchar_t *buf = cygwin_create_path (CCP_POSIX_TO_WIN_W, "/dev/sda");
  if (!buf)
  {
    perror ("cygwin_create_path");
    return 1;
  }
  printf("%ls\n", buf);
  return 0;
}



cygwin_create_path: Bad address


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019