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: <1da2-5ef37080-31-6d4cde00@228034409>
Date:   Wed, 24 Jun 2020 17:25:45 +0200
From:   "Kars Mulder" <kerneldev@...smulder.nl>
To:     "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>
Cc:     "Pavel Machek" <pavel@....cz>, linux-kernel@...r.kernel.org,
        "Kai-Heng Feng" <kai.heng.feng@...onical.com>
Subject: Re: Writing to a const pointer: is this 
 supposed to happen?

On Wednesday, June 24, 2020 15:10 CEST, Greg Kroah-Hartman wrote: 
> Have you hit any runtime issues with this code doing this?  These
> strings should be held in writable memory, right?  Or do you see a
> codepath where that is not the case?

I haven't ran into any issues with it; I was just looking at the code
as reference for a patch I'm working on.

I initially assumed that casting a const pointer to non-const and
writing to it would be undefined behaviour, but after reading through
the C99 standard I can't find an unambiguous statement whether it is
undefined behaviour even if the const pointer points to an object that
was originally non-const (like char* -> const char* -> char* casts); it
only says it is undefined behaviour if the object was defined with the
const qualifier.

I should probably stop bothering you with my newbie questions.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ