diff options
author | Swen Schillig <swen@linux.ibm.com> | 2019-01-30 09:31:34 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2019-03-01 00:32:11 +0000 |
commit | 2b2ff12e706d999ff2d84affa79c64b33cc289a7 (patch) | |
tree | 781f3790d19f8de0bd27d963bc443eebfe3e4dcd /source4/libcli | |
parent | 58e2c1534429c05adb0cf5957d281dca0286fc13 (diff) | |
download | samba-2b2ff12e706d999ff2d84affa79c64b33cc289a7.tar.gz |
source4: Use wrapper for string to integer conversion
In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.
Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Ralph Böhme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4/libcli')
-rw-r--r-- | source4/libcli/resolve/dns_ex.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source4/libcli/resolve/dns_ex.c b/source4/libcli/resolve/dns_ex.c index 6174b617cb3..a6863aed59e 100644 --- a/source4/libcli/resolve/dns_ex.c +++ b/source4/libcli/resolve/dns_ex.c @@ -514,6 +514,7 @@ static void pipe_handler(struct tevent_context *ev, struct tevent_fd *fde, uint32_t port = 0; char *p = strrchr(addrs[i], '@'); char *n; + int error = 0; if (!p) { composite_error(c, NT_STATUS_OBJECT_NAME_NOT_FOUND); @@ -536,8 +537,8 @@ static void pipe_handler(struct tevent_context *ev, struct tevent_fd *fde, composite_error(c, NT_STATUS_OBJECT_NAME_NOT_FOUND); return; } - port = strtoul(p, NULL, 10); - if (port > UINT16_MAX) { + port = strtoul_err(p, NULL, 10, &error); + if (port > UINT16_MAX || error != 0) { composite_error(c, NT_STATUS_OBJECT_NAME_NOT_FOUND); return; } |