lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bb3bfbfb-0761-23b2-24e9-e5b4cb3ffac6@ryhl.io>
Date:   Mon, 8 May 2023 22:29:00 +0200
From:   Alice Ryhl <alice@...l.io>
To:     Gary Guo <gary@...yguo.net>
Cc:     Miguel Ojeda <ojeda@...nel.org>,
        Wedson Almeida Filho <wedsonaf@...il.com>,
        Alex Gaynor <alex.gaynor@...il.com>,
        Boqun Feng <boqun.feng@...il.com>,
        Björn Roy Baron <bjorn3_gh@...tonmail.com>,
        Benno Lossin <benno.lossin@...ton.me>,
        Martin Rodriguez Reboredo <yakoyoku@...il.com>,
        rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
        patches@...ts.linux.dev
Subject: Re: [PATCH v2] rust: str: add conversion from `CStr` to `CString`

On 5/8/23 13:41, Gary Guo wrote:
> On Wed,  3 May 2023 14:10:16 +0000
> Alice Ryhl <aliceryhl@...gle.com> wrote:
> 
>> These methods can be used to copy the data in a temporary c string into
>> a separate allocation, so that it can be accessed later even if the
>> original is deallocated.
>>
>> The API in this change mirrors the standard library API for the `&str`
>> and `String` types. The `ToOwned` trait is not implemented because it
>> assumes that allocations are infallible.
> 
> How about add a `TryToOwned` trait to the kernel crate and implement
> that trait for `CStr` instead?

Eh, I don't think it's worth it. It doesn't give anything new to the 
CStr api, and I think it's rather unlikely that someone will actually 
need to be generic over such a trait any time soon.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ