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>
uint32_t alias_rid;
uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS;
struct dcerpc_binding_handle *b = cli->binding_handle;
+ int error = 0;
if (argc != 3) {
printf("Usage: %s builtin|domain [rid|name]\n", argv[0]);
return NT_STATUS_OK;
}
- alias_rid = strtoul(argv[2], NULL, 10);
+ alias_rid = strtoul_err(argv[2], NULL, 10, &error);
+ if (error != 0) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
/* Open SAMR handle */
union spoolss_PrinterData data;
DATA_BLOB blob;
struct dcerpc_binding_handle *b = cli->binding_handle;
+ int error = 0;
/* parse the command arguments */
if (argc < 5) {
W_ERROR_HAVE_NO_MEMORY(data.string);
break;
case REG_DWORD:
- data.value = strtoul(argv[4], NULL, 10);
+ data.value = strtoul_err(argv[4], NULL, 10, &error);
+ if (error != 0) {
+ result = WERR_INVALID_PARAMETER;
+ goto done;
+ }
+
break;
case REG_BINARY:
data.binary = strhex_to_data_blob(mem_ctx, argv[4]);