Changeset 988 for vendor/current/lib/tdr
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- Location:
- vendor/current/lib/tdr
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/lib/tdr/tdr.c
r740 r988 1 /* 1 /* 2 2 Unix SMB/CIFS implementation. 3 3 … … 6 6 7 7 Copyright (C) Jelmer Vernooij 2005 8 8 9 9 This program is free software; you can redistribute it and/or modify 10 10 it under the terms of the GNU General Public License as published by 11 11 the Free Software Foundation; either version 3 of the License, or 12 12 (at your option) any later version. 13 13 14 14 This program is distributed in the hope that it will be useful, 15 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 17 GNU General Public License for more details. 18 18 19 19 You should have received a copy of the GNU General Public License 20 20 along with this program. If not, see <http://www.gnu.org/licenses/>. … … 163 163 164 164 TDR_PULL_NEED_BYTES(tdr, el_size*length); 165 166 if (!convert_string_talloc(ctx, chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v), &ret , false)) {165 166 if (!convert_string_talloc(ctx, chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v), &ret)) { 167 167 return NT_STATUS_INVALID_PARAMETER; 168 168 } … … 175 175 NTSTATUS tdr_push_charset(struct tdr_push *tdr, const char **v, uint32_t length, uint32_t el_size, charset_t chset) 176 176 { 177 size_t ret, required; 177 size_t required, size = 0; 178 bool ret; 178 179 179 180 if (length == -1) { … … 184 185 TDR_PUSH_NEED_BYTES(tdr, required); 185 186 186 ret = convert_string(CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required, false);187 if (ret == -1) {187 ret = convert_string(CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required, &size); 188 if (ret == false) { 188 189 return NT_STATUS_INVALID_PARAMETER; 189 190 } 190 191 191 192 /* Make sure the remaining part of the string is filled with zeroes */ 192 if ( ret< required) {193 memset(tdr->data.data+tdr->data.length+ ret, 0, required-ret);194 } 195 193 if (size < required) { 194 memset(tdr->data.data+tdr->data.length+size, 0, required-size); 195 } 196 196 197 tdr->data.length += required; 197 198 198 199 return NT_STATUS_OK; 199 200 } … … 297 298 298 299 /* 299 push a DATA_BLOB onto the wire. 300 push a DATA_BLOB onto the wire. 300 301 */ 301 302 NTSTATUS tdr_push_DATA_BLOB(struct tdr_push *tdr, DATA_BLOB *blob) … … 310 311 311 312 TDR_PUSH_NEED_BYTES(tdr, blob->length); 312 313 313 314 memcpy(tdr->data.data+tdr->data.length, blob->data, blob->length); 314 315 return NT_STATUS_OK; … … 316 317 317 318 /* 318 pull a DATA_BLOB from the wire. 319 pull a DATA_BLOB from the wire. 319 320 */ 320 321 NTSTATUS tdr_pull_DATA_BLOB(struct tdr_pull *tdr, TALLOC_CTX *ctx, DATA_BLOB *blob) -
vendor/current/lib/tdr/testsuite.c
r740 r988 21 21 #include "includes.h" 22 22 #include "torture/torture.h" 23 #include "torture/local/proto.h" 23 24 #include "lib/tdr/tdr.h" 24 25
Note:
See TracChangeset
for help on using the changeset viewer.