s3:lib: fix/simplify srprs_hex()
commitda0ee7d866bf9713f80c074a509156bd1d8cf86f
authorStefan Metzmacher <metze@samba.org>
Thu, 13 Nov 2014 07:50:35 +0000 (13 08:50 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 25 Nov 2014 06:25:44 +0000 (25 07:25 +0100)
tree99e4569a7ec9deb7985ca0e3b44eead014691e1c
parent30c07907749063d0b0c663f1b43b02b4c6b0049d
s3:lib: fix/simplify srprs_hex()

There're a few problems with this function.

- it pretends to support values up to UINT64_MAX
  in it only returns 'unsigned' which support only
  values up to UINT32_MAX. Currently we only have
  callers with len=2 and len=8, so it's not a triggered
  bug.

  We just allow (len >= 1 && len <= 8) now.

- The compiler is not able to inspect the format string
  to sscanf().

  We copy up to 8 bytes into a stack buffer
  and always pass "%8x" to sscanf.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/srprs.c