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] [day] [month] [year] [list]
Date:   Thu, 9 Jul 2020 15:28:41 +0000
From:   Joakim Tjernlund <Joakim.Tjernlund@...inera.com>
To:     "rasmus.villemoes@...vas.dk" <rasmus.villemoes@...vas.dk>,
        "schwab@...ux-m68k.org" <schwab@...ux-m68k.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: printk of non NULL terminated strings ?

On Thu, 2020-07-09 at 15:30 +0200, Rasmus Villemoes wrote:
> On 09/07/2020 15.26, Joakim Tjernlund wrote:
> > On Thu, 2020-07-09 at 14:56 +0200, Andreas Schwab wrote:
> > > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
> > > 
> > > 
> > > On Jul 09 2020, Joakim Tjernlund wrote:
> > > 
> > > > Is there a format (or other function) that lets me
> > > > print strings without an \0 terminator using an explicit length arg instead?
> > > 
> > > Use the precision.
> > 
> > Looking at that now but have a hard time figuring how to use it, can you give me an example?
> 
> Exactly as you'd do in userspace:
> 
>   printf("%.*s\n", len, buf)
> 
> Of course, vsnprintf() will still stop if it encounters a nul byte
> within those first len bytes in buf. And you need len to have type int,
> so you may need a cast if you have a size_t or ssize_t or whatnot.

Thanks, this did the trick :)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ