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>] [day] [month] [year] [list]
Date:	Mon, 12 Jan 2015 13:07:38 +0400
From:	Aleksandr P <alexpikptz@...il.com>
To:	me@...tis.eu
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Cleanup: snprintf() always NUL-terminates: depend on it

>   len = snprintf(fname, 99, "%s", buf);
> - fname[len-1] = '\0';

> I just deleted that "really, really" NUL-termination line because
> it was based on a misunderstanding of snprintf()'s postcondition.

Are you sure this code can be simple deleted? It does not only
terminate the string but deletes the last character. According to man:
" Upon successful return, these functions return the number of
characters printed (EXCLUDING the null  byte  used  to end output to
strings)."
So, if buf was "abc" len would be 3 and fname would become "ab".

Best regards,
Alexandr
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ