2 Unix SMB/CIFS implementation.
3 Samba memory buffer functions
4 Copyright (C) Andrew Tridgell 1992-1997
5 Copyright (C) Luke Kenneth Casson Leighton 1996-1997
6 Copyright (C) Jeremy Allison 1999
7 Copyright (C) Andrew Bartlett 2003.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #include "../librpc/gen_ndr/ndr_schannel.h"
27 #define DBGC_CLASS DBGC_RPC_PARSE
30 * Dump a prs to a file: from the current location through to the end.
32 void prs_dump(const char *name, int v, prs_struct *ps)
34 prs_dump_region(name, v, ps, ps->data_offset, ps->buffer_size);
38 * Dump from the start of the prs to the current location.
40 void prs_dump_before(const char *name, int v, prs_struct *ps)
42 prs_dump_region(name, v, ps, 0, ps->data_offset);
46 * Dump everything from the start of the prs up to the current location.
48 void prs_dump_region(const char *name, int v, prs_struct *ps,
49 int from_off, int to_off)
54 if (DEBUGLEVEL < 50) return;
57 if (asprintf(&fname,"/tmp/%s_%d.%d.prs", name, v, i) < 0) {
61 if (asprintf(&fname,"/tmp/%s.%d.prs", name, i) < 0) {
65 fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644);
66 if (fd != -1 || errno != EEXIST) break;
69 sz = write(fd, ps->data_p + from_off, to_off - from_off);
71 if ( (sz != to_off-from_off) || (i != 0) ) {
72 DEBUG(0,("Error writing/closing %s: %ld!=%ld %d\n", fname, (unsigned long)sz, (unsigned long)to_off-from_off, i ));
74 DEBUG(0,("created %s\n", fname));
80 /*******************************************************************
81 Debug output for parsing info
83 XXXX side-effect of this function is to increase the debug depth XXXX.
85 ********************************************************************/
87 void prs_debug(prs_struct *ps, int depth, const char *desc, const char *fn_name)
89 DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(5+depth,depth), ps->data_offset, fn_name, desc));
93 * Initialise an expandable parse structure.
95 * @param size Initial buffer size. If >0, a new buffer will be
96 * created with malloc().
98 * @return False if allocation fails, otherwise True.
101 bool prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, bool io)
105 ps->bigendian_data = RPC_LITTLE_ENDIAN;
106 ps->align = RPC_PARSE_ALIGN;
107 ps->is_dynamic = False;
114 ps->buffer_size = size;
115 if((ps->data_p = (char *)SMB_MALLOC((size_t)size)) == NULL) {
116 DEBUG(0,("prs_init: malloc fail for %u bytes.\n", (unsigned int)size));
119 memset(ps->data_p, '\0', (size_t)size);
120 ps->is_dynamic = True; /* We own this memory. */
121 } else if (MARSHALLING(ps)) {
122 /* If size is zero and we're marshalling we should allocate memory on demand. */
123 ps->is_dynamic = True;
129 /*******************************************************************
130 Delete the memory in a parse structure - if we own it.
132 NOTE: Contrary to the somewhat confusing naming, this function is not
133 intended for freeing memory allocated by prs_alloc_mem(). That memory
134 is attached to the talloc context given by ps->mem_ctx.
135 ********************************************************************/
137 void prs_mem_free(prs_struct *ps)
140 SAFE_FREE(ps->data_p);
141 ps->is_dynamic = False;
146 /*******************************************************************
147 Clear the memory in a parse structure.
148 ********************************************************************/
150 void prs_mem_clear(prs_struct *ps)
153 memset(ps->data_p, '\0', (size_t)ps->buffer_size);
156 /*******************************************************************
157 Allocate memory when unmarshalling... Always zero clears.
158 ********************************************************************/
160 #if defined(PARANOID_MALLOC_CHECKER)
161 char *prs_alloc_mem_(prs_struct *ps, size_t size, unsigned int count)
163 char *prs_alloc_mem(prs_struct *ps, size_t size, unsigned int count)
169 /* We can't call the type-safe version here. */
170 ret = (char *)_talloc_zero_array(ps->mem_ctx, size, count,
176 /*******************************************************************
177 Return the current talloc context we're using.
178 ********************************************************************/
180 TALLOC_CTX *prs_get_mem_context(prs_struct *ps)
185 /*******************************************************************
186 Hand some already allocated memory to a prs_struct.
187 ********************************************************************/
189 void prs_give_memory(prs_struct *ps, char *buf, uint32 size, bool is_dynamic)
191 ps->is_dynamic = is_dynamic;
193 ps->buffer_size = size;
196 /*******************************************************************
197 Set a prs_struct to exactly a given size. Will grow or tuncate if neccessary.
198 ********************************************************************/
200 bool prs_set_buffer_size(prs_struct *ps, uint32 newsize)
202 if (newsize > ps->buffer_size)
203 return prs_force_grow(ps, newsize - ps->buffer_size);
205 if (newsize < ps->buffer_size) {
206 ps->buffer_size = newsize;
208 /* newsize == 0 acts as a free and set pointer to NULL */
210 SAFE_FREE(ps->data_p);
212 ps->data_p = (char *)SMB_REALLOC(ps->data_p, newsize);
214 if (ps->data_p == NULL) {
215 DEBUG(0,("prs_set_buffer_size: Realloc failure for size %u.\n",
216 (unsigned int)newsize));
217 DEBUG(0,("prs_set_buffer_size: Reason %s\n",strerror(errno)));
226 /*******************************************************************
227 Attempt, if needed, to grow a data buffer.
228 Also depends on the data stream mode (io).
229 ********************************************************************/
231 bool prs_grow(prs_struct *ps, uint32 extra_space)
235 ps->grow_size = MAX(ps->grow_size, ps->data_offset + extra_space);
237 if(ps->data_offset + extra_space <= ps->buffer_size)
241 * We cannot grow the buffer if we're not reading
242 * into the prs_struct, or if we don't own the memory.
245 if(UNMARSHALLING(ps) || !ps->is_dynamic) {
246 DEBUG(0,("prs_grow: Buffer overflow - unable to expand buffer by %u bytes.\n",
247 (unsigned int)extra_space));
252 * Decide how much extra space we really need.
255 extra_space -= (ps->buffer_size - ps->data_offset);
256 if(ps->buffer_size == 0) {
259 * Start with 128 bytes (arbitrary value), enough for small rpc
262 new_size = MAX(128, extra_space);
264 if((ps->data_p = (char *)SMB_MALLOC(new_size)) == NULL) {
265 DEBUG(0,("prs_grow: Malloc failure for size %u.\n", (unsigned int)new_size));
268 memset(ps->data_p, '\0', (size_t)new_size );
271 * If the current buffer size is bigger than the space needed,
272 * just double it, else add extra_space. Always keep 64 bytes
273 * more, so that after we added a large blob we don't have to
274 * realloc immediately again.
276 new_size = MAX(ps->buffer_size*2,
277 ps->buffer_size + extra_space + 64);
279 if ((ps->data_p = (char *)SMB_REALLOC(ps->data_p, new_size)) == NULL) {
280 DEBUG(0,("prs_grow: Realloc failure for size %u.\n",
281 (unsigned int)new_size));
285 memset(&ps->data_p[ps->buffer_size], '\0', (size_t)(new_size - ps->buffer_size));
287 ps->buffer_size = new_size;
292 /*******************************************************************
293 Attempt to force a data buffer to grow by len bytes.
294 This is only used when appending more data onto a prs_struct
295 when reading an rpc reply, before unmarshalling it.
296 ********************************************************************/
298 bool prs_force_grow(prs_struct *ps, uint32 extra_space)
300 uint32 new_size = ps->buffer_size + extra_space;
302 if(!UNMARSHALLING(ps) || !ps->is_dynamic) {
303 DEBUG(0,("prs_force_grow: Buffer overflow - unable to expand buffer by %u bytes.\n",
304 (unsigned int)extra_space));
308 if((ps->data_p = (char *)SMB_REALLOC(ps->data_p, new_size)) == NULL) {
309 DEBUG(0,("prs_force_grow: Realloc failure for size %u.\n",
310 (unsigned int)new_size));
314 memset(&ps->data_p[ps->buffer_size], '\0', (size_t)(new_size - ps->buffer_size));
316 ps->buffer_size = new_size;
321 /*******************************************************************
322 Get the data pointer (external interface).
323 ********************************************************************/
325 char *prs_data_p(prs_struct *ps)
330 /*******************************************************************
331 Get the current data size (external interface).
332 ********************************************************************/
334 uint32 prs_data_size(prs_struct *ps)
336 return ps->buffer_size;
339 /*******************************************************************
340 Fetch the current offset (external interface).
341 ********************************************************************/
343 uint32 prs_offset(prs_struct *ps)
345 return ps->data_offset;
348 /*******************************************************************
349 Set the current offset (external interface).
350 ********************************************************************/
352 bool prs_set_offset(prs_struct *ps, uint32 offset)
354 if ((offset > ps->data_offset)
355 && !prs_grow(ps, offset - ps->data_offset)) {
359 ps->data_offset = offset;
363 /*******************************************************************
364 Append the data from one parse_struct into another.
365 ********************************************************************/
367 bool prs_append_prs_data(prs_struct *dst, prs_struct *src)
369 if (prs_offset(src) == 0)
372 if(!prs_grow(dst, prs_offset(src)))
375 memcpy(&dst->data_p[dst->data_offset], src->data_p, (size_t)prs_offset(src));
376 dst->data_offset += prs_offset(src);
381 /*******************************************************************
382 Append some data from one parse_struct into another.
383 ********************************************************************/
385 bool prs_append_some_data(prs_struct *dst, void *src_base, uint32_t start,
392 if(!prs_grow(dst, len)) {
396 memcpy(&dst->data_p[dst->data_offset], ((char *)src_base) + start, (size_t)len);
397 dst->data_offset += len;
401 bool prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start,
404 return prs_append_some_data(dst, src->data_p, start, len);
407 /*******************************************************************
408 Append the data from a buffer into a parse_struct.
409 ********************************************************************/
411 bool prs_copy_data_in(prs_struct *dst, const char *src, uint32 len)
416 if(!prs_grow(dst, len))
419 memcpy(&dst->data_p[dst->data_offset], src, (size_t)len);
420 dst->data_offset += len;
425 /*******************************************************************
426 Copy some data from a parse_struct into a buffer.
427 ********************************************************************/
429 bool prs_copy_data_out(char *dst, prs_struct *src, uint32 len)
434 if(!prs_mem_get(src, len))
437 memcpy(dst, &src->data_p[src->data_offset], (size_t)len);
438 src->data_offset += len;
443 /*******************************************************************
444 Copy all the data from a parse_struct into a buffer.
445 ********************************************************************/
447 bool prs_copy_all_data_out(char *dst, prs_struct *src)
449 uint32 len = prs_offset(src);
454 prs_set_offset(src, 0);
455 return prs_copy_data_out(dst, src, len);
458 /*******************************************************************
459 Set the data as X-endian (external interface).
460 ********************************************************************/
462 void prs_set_endian_data(prs_struct *ps, bool endian)
464 ps->bigendian_data = endian;
467 /*******************************************************************
468 Align a the data_len to a multiple of align bytes - filling with
470 ********************************************************************/
472 bool prs_align(prs_struct *ps)
474 uint32 mod = ps->data_offset & (ps->align-1);
476 if (ps->align != 0 && mod != 0) {
477 uint32 extra_space = (ps->align - mod);
478 if(!prs_grow(ps, extra_space))
480 memset(&ps->data_p[ps->data_offset], '\0', (size_t)extra_space);
481 ps->data_offset += extra_space;
487 /******************************************************************
488 Align on a 2 byte boundary
489 *****************************************************************/
491 bool prs_align_uint16(prs_struct *ps)
494 uint8 old_align = ps->align;
498 ps->align = old_align;
503 /******************************************************************
504 Align on a 8 byte boundary
505 *****************************************************************/
507 bool prs_align_uint64(prs_struct *ps)
510 uint8 old_align = ps->align;
514 ps->align = old_align;
519 /******************************************************************
520 Align on a specific byte boundary
521 *****************************************************************/
523 bool prs_align_custom(prs_struct *ps, uint8 boundary)
526 uint8 old_align = ps->align;
528 ps->align = boundary;
530 ps->align = old_align;
537 /*******************************************************************
538 Align only if required (for the unistr2 string mainly)
539 ********************************************************************/
541 bool prs_align_needed(prs_struct *ps, uint32 needed)
546 return prs_align(ps);
549 /*******************************************************************
550 Ensure we can read/write to a given offset.
551 ********************************************************************/
553 char *prs_mem_get(prs_struct *ps, uint32 extra_size)
555 if(UNMARSHALLING(ps)) {
557 * If reading, ensure that we can read the requested size item.
559 if (ps->data_offset + extra_size > ps->buffer_size) {
560 DEBUG(0,("prs_mem_get: reading data of size %u would overrun "
561 "buffer by %u bytes.\n",
562 (unsigned int)extra_size,
563 (unsigned int)(ps->data_offset + extra_size - ps->buffer_size) ));
568 * Writing - grow the buffer if needed.
570 if(!prs_grow(ps, extra_size))
573 return &ps->data_p[ps->data_offset];
576 /*******************************************************************
577 Change the struct type.
578 ********************************************************************/
580 void prs_switch_type(prs_struct *ps, bool io)
582 if ((ps->io ^ io) == True)
586 /*******************************************************************
587 Force a prs_struct to be dynamic even when it's size is 0.
588 ********************************************************************/
590 void prs_force_dynamic(prs_struct *ps)
595 /*******************************************************************
596 Associate a session key with a parse struct.
597 ********************************************************************/
599 void prs_set_session_key(prs_struct *ps, const char sess_key[16])
601 ps->sess_key = sess_key;
604 /*******************************************************************
606 ********************************************************************/
608 bool prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8)
610 char *q = prs_mem_get(ps, 1);
614 if (UNMARSHALLING(ps))
619 DEBUGADD(5,("%s%04x %s: %02x\n", tab_depth(5,depth), ps->data_offset, name, *data8));
621 ps->data_offset += 1;
626 /*******************************************************************
628 ********************************************************************/
630 bool prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16)
632 char *q = prs_mem_get(ps, sizeof(uint16));
636 if (UNMARSHALLING(ps)) {
637 if (ps->bigendian_data)
638 *data16 = RSVAL(q,0);
642 if (ps->bigendian_data)
648 DEBUGADD(5,("%s%04x %s: %04x\n", tab_depth(5,depth), ps->data_offset, name, *data16));
650 ps->data_offset += sizeof(uint16);
655 /*******************************************************************
657 ********************************************************************/
659 bool prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32)
661 char *q = prs_mem_get(ps, sizeof(uint32));
665 if (UNMARSHALLING(ps)) {
666 if (ps->bigendian_data)
667 *data32 = RIVAL(q,0);
671 if (ps->bigendian_data)
677 DEBUGADD(5,("%s%04x %s: %08x\n", tab_depth(5,depth), ps->data_offset, name, *data32));
679 ps->data_offset += sizeof(uint32);
684 /*******************************************************************
686 ********************************************************************/
688 bool prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32)
690 char *q = prs_mem_get(ps, sizeof(int32));
694 if (UNMARSHALLING(ps)) {
695 if (ps->bigendian_data)
696 *data32 = RIVALS(q,0);
698 *data32 = IVALS(q,0);
700 if (ps->bigendian_data)
701 RSIVALS(q,0,*data32);
706 DEBUGADD(5,("%s%04x %s: %08x\n", tab_depth(5,depth), ps->data_offset, name, *data32));
708 ps->data_offset += sizeof(int32);
713 /*******************************************************************
714 Stream a uint64_struct
715 ********************************************************************/
716 bool prs_uint64(const char *name, prs_struct *ps, int depth, uint64 *data64)
718 if (UNMARSHALLING(ps)) {
721 if (!prs_uint32(name, ps, depth+1, &low))
724 if (!prs_uint32(name, ps, depth+1, &high))
727 *data64 = ((uint64_t)high << 32) + low;
731 uint32 high = (*data64) >> 32, low = (*data64) & 0xFFFFFFFF;
732 return prs_uint32(name, ps, depth+1, &low) &&
733 prs_uint32(name, ps, depth+1, &high);
737 /*******************************************************************
738 Stream a DCE error code
739 ********************************************************************/
741 bool prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *status)
743 char *q = prs_mem_get(ps, sizeof(uint32));
747 if (UNMARSHALLING(ps)) {
748 if (ps->bigendian_data)
749 *status = NT_STATUS(RIVAL(q,0));
751 *status = NT_STATUS(IVAL(q,0));
753 if (ps->bigendian_data)
754 RSIVAL(q,0,NT_STATUS_V(*status));
756 SIVAL(q,0,NT_STATUS_V(*status));
759 DEBUGADD(5,("%s%04x %s: %s\n", tab_depth(5,depth), ps->data_offset, name,
760 dcerpc_errstr(talloc_tos(), NT_STATUS_V(*status))));
762 ps->data_offset += sizeof(uint32);
767 /******************************************************************
768 Stream an array of uint8s. Length is number of uint8s.
769 ********************************************************************/
771 bool prs_uint8s(bool charmode, const char *name, prs_struct *ps, int depth, uint8 *data8s, int len)
774 char *q = prs_mem_get(ps, len);
778 if (UNMARSHALLING(ps)) {
779 for (i = 0; i < len; i++)
780 data8s[i] = CVAL(q,i);
782 for (i = 0; i < len; i++)
783 SCVAL(q, i, data8s[i]);
786 DEBUGADD(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset ,name));
788 print_asc(5, (unsigned char*)data8s, len);
790 for (i = 0; i < len; i++)
791 DEBUGADD(5,("%02x ", data8s[i]));
795 ps->data_offset += len;
800 /******************************************************************
801 Stream an array of uint16s. Length is number of uint16s.
802 ********************************************************************/
804 bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len)
807 char *q = prs_mem_get(ps, len * sizeof(uint16));
811 if (UNMARSHALLING(ps)) {
812 if (ps->bigendian_data) {
813 for (i = 0; i < len; i++)
814 data16s[i] = RSVAL(q, 2*i);
816 for (i = 0; i < len; i++)
817 data16s[i] = SVAL(q, 2*i);
820 if (ps->bigendian_data) {
821 for (i = 0; i < len; i++)
822 RSSVAL(q, 2*i, data16s[i]);
824 for (i = 0; i < len; i++)
825 SSVAL(q, 2*i, data16s[i]);
829 DEBUGADD(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
831 print_asc(5, (unsigned char*)data16s, 2*len);
833 for (i = 0; i < len; i++)
834 DEBUGADD(5,("%04x ", data16s[i]));
838 ps->data_offset += (len * sizeof(uint16));
843 /******************************************************************
844 Stream an array of uint32s. Length is number of uint32s.
845 ********************************************************************/
847 bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, uint32 *data32s, int len)
850 char *q = prs_mem_get(ps, len * sizeof(uint32));
854 if (UNMARSHALLING(ps)) {
855 if (ps->bigendian_data) {
856 for (i = 0; i < len; i++)
857 data32s[i] = RIVAL(q, 4*i);
859 for (i = 0; i < len; i++)
860 data32s[i] = IVAL(q, 4*i);
863 if (ps->bigendian_data) {
864 for (i = 0; i < len; i++)
865 RSIVAL(q, 4*i, data32s[i]);
867 for (i = 0; i < len; i++)
868 SIVAL(q, 4*i, data32s[i]);
872 DEBUGADD(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
874 print_asc(5, (unsigned char*)data32s, 4*len);
876 for (i = 0; i < len; i++)
877 DEBUGADD(5,("%08x ", data32s[i]));
881 ps->data_offset += (len * sizeof(uint32));
886 /*******************************************************************
887 Stream a unicode null-terminated string. As the string is already
888 in little-endian format then do it as a stream of bytes.
889 ********************************************************************/
891 bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str)
893 unsigned int len = 0;
894 unsigned char *p = (unsigned char *)str->buffer;
900 if (MARSHALLING(ps)) {
902 for(len = 0; str->buffer[len] != 0; len++)
905 q = prs_mem_get(ps, (len+1)*2);
911 for(len = 0; str->buffer[len] != 0; len++) {
912 if(ps->bigendian_data) {
913 /* swap bytes - p is little endian, q is big endian. */
929 * even if the string is 'empty' (only an \0 char)
930 * at this point the leading \0 hasn't been parsed.
940 DEBUGADD(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
941 print_asc(5, (unsigned char*)start, 2*len);
944 else { /* unmarshalling */
946 uint32 alloc_len = 0;
947 q = ps->data_p + prs_offset(ps);
950 * Work out how much space we need and talloc it.
952 max_len = (ps->buffer_size - ps->data_offset)/sizeof(uint16);
954 /* the test of the value of *ptr helps to catch the circumstance
955 where we have an emtpty (non-existent) string in the buffer */
956 for ( ptr = (uint16 *)q; *ptr++ && (alloc_len <= max_len); alloc_len++)
960 if (alloc_len < max_len)
963 /* should we allocate anything at all? */
964 str->buffer = PRS_ALLOC_MEM(ps,uint16,alloc_len);
965 if ((str->buffer == NULL) && (alloc_len > 0))
968 p = (unsigned char *)str->buffer;
971 /* the (len < alloc_len) test is to prevent us from overwriting
972 memory that is not ours...if we get that far, we have a non-null
973 terminated string in the buffer and have messed up somewhere */
974 while ((len < alloc_len) && (*(uint16 *)q != 0)) {
975 if(ps->bigendian_data)
977 /* swap bytes - q is big endian, p is little endian. */
978 p[0] = (unsigned char)q[1];
979 p[1] = (unsigned char)q[0];
984 p[0] = (unsigned char)q[0];
985 p[1] = (unsigned char)q[1];
992 if (len < alloc_len) {
993 /* NULL terminate the UNISTR */
994 str->buffer[len++] = '\0';
997 DEBUGADD(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
998 print_asc(5, (unsigned char*)str->buffer, 2*len);
1002 /* set the offset in the prs_struct; 'len' points to the
1003 terminiating NULL in the UNISTR so we need to go one more
1005 ps->data_offset += (len)*2;
1010 /*******************************************************************
1011 creates a new prs_struct containing a DATA_BLOB
1012 ********************************************************************/
1013 bool prs_init_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx)
1015 if (!prs_init( prs, RPC_MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL ))
1019 if (!prs_copy_data_in(prs, (char *)blob->data, blob->length))
1025 /*******************************************************************
1026 return the contents of a prs_struct in a DATA_BLOB
1027 ********************************************************************/
1028 bool prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx)
1030 blob->length = prs_data_size(prs);
1031 blob->data = (uint8 *)TALLOC_ZERO_SIZE(mem_ctx, blob->length);
1033 /* set the pointer at the end of the buffer */
1034 prs_set_offset( prs, prs_data_size(prs) );
1036 if (!prs_copy_all_data_out((char *)blob->data, prs))