diff options
Diffstat (limited to 'source4/libcli/raw')
-rw-r--r-- | source4/libcli/raw/rawfileinfo.c | 8 | ||||
-rw-r--r-- | source4/libcli/raw/rawrequest.c | 32 |
2 files changed, 22 insertions, 18 deletions
diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index b8f4e5116c..09ecb40002 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -49,7 +49,7 @@ NTSTATUS smbcli_parse_stream_info(DATA_BLOB blob, TALLOC_CTX *mem_ctx, while (blob.length - ofs >= 24) { uint_t n = io->num_streams; uint32_t nlen, len; - ssize_t size; + bool ret; void *vstr; io->streams = talloc_realloc(mem_ctx, io->streams, struct stream_struct, n+1); @@ -62,10 +62,10 @@ NTSTATUS smbcli_parse_stream_info(DATA_BLOB blob, TALLOC_CTX *mem_ctx, if (nlen > blob.length - (ofs + 24)) { return NT_STATUS_INFO_LENGTH_MISMATCH; } - size = convert_string_talloc(io->streams, + ret = convert_string_talloc(io->streams, CH_UTF16, CH_UNIX, - blob.data+ofs+24, nlen, &vstr, false); - if (size == -1) { + blob.data+ofs+24, nlen, &vstr, NULL, false); + if (!ret) { return NT_STATUS_ILLEGAL_CHARACTER; } io->streams[n].stream_name.s = (const char *)vstr; diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c index 5b461b47fd..0f04190a8b 100644 --- a/source4/libcli/raw/rawrequest.c +++ b/source4/libcli/raw/rawrequest.c @@ -558,7 +558,8 @@ static size_t smbcli_req_pull_ucs2(struct request_bufinfo *bufinfo, TALLOC_CTX * char **dest, const uint8_t *src, int byte_len, uint_t flags) { int src_len, src_len2, alignment=0; - ssize_t ret; + bool ret; + size_t ret_size; if (!(flags & STR_NOALIGN) && ucs2_align(bufinfo->align_base, src, flags)) { src++; @@ -585,8 +586,8 @@ static size_t smbcli_req_pull_ucs2(struct request_bufinfo *bufinfo, TALLOC_CTX * return 0; } - ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)dest, false); - if (ret == -1) { + ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)dest, &ret_size, false); + if (!ret) { *dest = NULL; return 0; } @@ -611,7 +612,8 @@ size_t smbcli_req_pull_ascii(struct request_bufinfo *bufinfo, TALLOC_CTX *mem_ct char **dest, const uint8_t *src, int byte_len, uint_t flags) { int src_len, src_len2; - ssize_t ret; + bool ret; + size_t ret_size; src_len = bufinfo->data_size - PTR_DIFF(src, bufinfo->data); if (src_len < 0) { @@ -627,14 +629,14 @@ size_t smbcli_req_pull_ascii(struct request_bufinfo *bufinfo, TALLOC_CTX *mem_ct src_len2++; } - ret = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)dest, false); + ret = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)dest, &ret_size, false); - if (ret == -1) { + if (!ret) { *dest = NULL; return 0; } - return ret; + return ret_size; } /** @@ -752,7 +754,8 @@ size_t smbcli_blob_pull_ucs2(TALLOC_CTX* mem_ctx, const uint8_t *src, int byte_len, uint_t flags) { int src_len, src_len2, alignment=0; - ssize_t ret; + size_t ret_size; + bool ret; char *dest2; if (src < blob->data || @@ -780,8 +783,8 @@ size_t smbcli_blob_pull_ucs2(TALLOC_CTX* mem_ctx, src_len2 = utf16_len_n(src, src_len); - ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2, false); - if (ret == -1) { + ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2, &ret_size, false); + if (!ret) { *dest = NULL; return 0; } @@ -808,7 +811,8 @@ static size_t smbcli_blob_pull_ascii(TALLOC_CTX *mem_ctx, const uint8_t *src, int byte_len, uint_t flags) { int src_len, src_len2; - ssize_t ret; + size_t ret_size; + bool ret; char *dest2; src_len = blob->length - PTR_DIFF(src, blob->data); @@ -826,15 +830,15 @@ static size_t smbcli_blob_pull_ascii(TALLOC_CTX *mem_ctx, src_len2++; } - ret = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2, false); + ret = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2, &ret_size, false); - if (ret == -1) { + if (!ret) { *dest = NULL; return 0; } *dest = dest2; - return ret; + return ret_size; } /** |