diff options
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/clifile.c | 19 | ||||
-rw-r--r-- | source3/libsmb/proto.h | 2 |
2 files changed, 21 insertions, 0 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 9bb83ec9c6..3fa124e6f1 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -136,6 +136,25 @@ uint8_t *trans2_bytes_push_str(uint8_t *buf, bool ucs2, false, pconverted_size); } +uint8_t *trans2_bytes_push_bytes(uint8_t *buf, + const uint8_t *bytes, size_t num_bytes) +{ + size_t buflen; + + if (buf == NULL) { + return NULL; + } + buflen = talloc_get_size(buf); + + buf = talloc_realloc(NULL, buf, uint8_t, + buflen + num_bytes); + if (buf == NULL) { + return NULL; + } + memcpy(&buf[buflen], bytes, num_bytes); + return buf; +} + struct cli_setpathinfo_state { uint16_t setup; uint8_t *param; diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h index 9783b0d0e8..ac0e031a62 100644 --- a/source3/libsmb/proto.h +++ b/source3/libsmb/proto.h @@ -357,6 +357,8 @@ uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix, uint8_t *trans2_bytes_push_str(uint8_t *buf, bool ucs2, const char *str, size_t str_len, size_t *pconverted_size); +uint8_t *trans2_bytes_push_bytes(uint8_t *buf, + const uint8_t *bytes, size_t num_bytes); struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx, struct event_context *ev, struct cli_state *cli, const char *fname, |