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: <Z0eGY_6e9jVMezxE@fjasle.eu>
Date: Wed, 27 Nov 2024 21:51:47 +0100
From: Nicolas Schier <nicolas@...sle.eu>
To: Advait Dhamorikar <advaitdhamorikar@...il.com>
Cc: Masahiro Yamada <masahiroy@...nel.org>,
 Nathan Chancellor <nathan@...nel.org>, linux-kbuild@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH-next] modpost: Remove logically dead condition

On Wed, Nov 27, 2024 at 09:59:04PM +0530 Advait Dhamorikar wrote:
> In case of failure vsnprintf returns `pos`, an unsigned long integer.
> An unsigned value can never be negative, so this test will always evaluate 
> the same way. 

'man vsnprintf' on my system reveals a different behaviour:

| The  functions  snprintf() and vsnprintf() do not
| write more than size bytes (including the  termiā€
| nating  null  byte  ('\0')).   If  the output was
| truncated due to  this  limit,  then  the  return
| value  is the number of characters (excluding the
| terminating null  byte)  which  would  have  been
| written  to  the final string if enough space had
| been available.  Thus, a return value of size  or
| more  means  that the output was truncated.  (See
| also below under NOTES.)
|
| If an output error  is  encountered,  a  negative
| value is returned.

vsnprintf prototypes also indicate 'int' as return type.  What is the source of your mentioned findings?

Kind regards,
Nicolas


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ