get_sha1_hex(): do not read past a NUL character