mirror of
https://github.com/samba-team/samba.git
synced 2025-02-07 01:58:28 +03:00
r4139: 2nd attempt at fixing the null ptr in size_is() problem.
This commit is contained in:
parent
952a26c561
commit
3040cd6515
@ -288,14 +288,18 @@ sub CheckArraySizes($$)
|
|||||||
|
|
||||||
if (util::has_property($e, "size_is")) {
|
if (util::has_property($e, "size_is")) {
|
||||||
my $size = find_size_var($e, util::array_size($e), $var_prefix);
|
my $size = find_size_var($e, util::array_size($e), $var_prefix);
|
||||||
|
pidl "\tif ($var_prefix$e->{NAME}) {\n";
|
||||||
check_null_pointer($size);
|
check_null_pointer($size);
|
||||||
pidl "\tNDR_CHECK(ndr_check_array_size(ndr, (void*)&$var_prefix$e->{NAME}, $size));\n";
|
pidl "\t\tNDR_CHECK(ndr_check_array_size(ndr, (void*)&$var_prefix$e->{NAME}, $size));\n";
|
||||||
|
pidl "\t}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (my $length = util::has_property($e, "length_is")) {
|
if (my $length = util::has_property($e, "length_is")) {
|
||||||
$length = find_size_var($e, $length, $var_prefix);
|
$length = find_size_var($e, $length, $var_prefix);
|
||||||
|
pidl "\tif ($var_prefix$e->{NAME}) {\n";
|
||||||
check_null_pointer($length);
|
check_null_pointer($length);
|
||||||
pidl "\tNDR_CHECK(ndr_check_array_length(ndr, (void*)&$var_prefix$e->{NAME}, $length));\n";
|
pidl "\t\tNDR_CHECK(ndr_check_array_length(ndr, (void*)&$var_prefix$e->{NAME}, $length));\n";
|
||||||
|
pidl "\t}\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,12 +700,9 @@ uint32_t ndr_get_array_size(struct ndr_pull *ndr, const void *p)
|
|||||||
/*
|
/*
|
||||||
check the stored array size field
|
check the stored array size field
|
||||||
*/
|
*/
|
||||||
NTSTATUS ndr_check_array_size(struct ndr_pull *ndr, const void **p, uint32_t size)
|
NTSTATUS ndr_check_array_size(struct ndr_pull *ndr, void *p, uint32_t size)
|
||||||
{
|
{
|
||||||
uint32 stored;
|
uint32_t stored;
|
||||||
if (*p == NULL) {
|
|
||||||
return NT_STATUS_OK;
|
|
||||||
}
|
|
||||||
NDR_CHECK(ndr_token_retrieve(&ndr->array_size_list, p, &stored));
|
NDR_CHECK(ndr_token_retrieve(&ndr->array_size_list, p, &stored));
|
||||||
if (stored != size) {
|
if (stored != size) {
|
||||||
return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
|
return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
|
||||||
@ -744,9 +741,6 @@ uint32_t ndr_get_array_length(struct ndr_pull *ndr, const void *p)
|
|||||||
NTSTATUS ndr_check_array_length(struct ndr_pull *ndr, void *p, uint32_t length)
|
NTSTATUS ndr_check_array_length(struct ndr_pull *ndr, void *p, uint32_t length)
|
||||||
{
|
{
|
||||||
uint32_t stored;
|
uint32_t stored;
|
||||||
if (*(void **)p == NULL) {
|
|
||||||
return NT_STATUS_OK;
|
|
||||||
}
|
|
||||||
NDR_CHECK(ndr_token_retrieve(&ndr->array_length_list, p, &stored));
|
NDR_CHECK(ndr_token_retrieve(&ndr->array_length_list, p, &stored));
|
||||||
if (stored != length) {
|
if (stored != length) {
|
||||||
return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
|
return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user