chiark / gitweb /
gpg: Don't assume that strtoul interprets "" as 0.
authorNeal H. Walfield <neal@g10code.com>
Thu, 2 Feb 2017 14:48:45 +0000 (15:48 +0100)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Mon, 18 Sep 2017 20:41:12 +0000 (21:41 +0100)
commitea854e72efbbf0907cd57b2c656d3f79c3d0c5a4
treeecfbf038b84eaac57bac458e9d6e9f1725a4c5fb
parent2fc26dbcbd6a2b47d850e1dbeeb97d44d204795a
gpg: Don't assume that strtoul interprets "" as 0.

* g10/tofu.c (show_statistics): If there are not records, return 0
instead of NULL.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
GnuPG-bug-id: 2853

According to SUSv3:

  If the subject sequence is empty or does not have the expected form,
  no conversion is performed
  ...
  If no conversion could be performed, 0 is returned and errno may be
  set to [EINVAL].

  http://pubs.opengroup.org/onlinepubs/007908799/xsh/strtol.html

It appears that MacOS X sets errno to EINVAL, but glibc doesn't.
Hence, we map NULL to 0 explicitly.

(cherry picked from commit 407f5f9baea5591f148974240a87dfb43e5efef3)

Gbp-Pq: Name 0025-gpg-Don-t-assume-that-strtoul-interprets-as-0.patch
g10/tofu.c