Project

General

Profile

Bug #8180 ยป test.c

Marcel Telka, 2017-05-08 08:12 AM

 
1
#include <string.h>
2
#include <rpc/xdr.h>
3
#include <rpc/rpcb_prot.h>
4

    
5
int
6
main(void)
7
{
8
	XDR xdrs;
9
	char buf[] = {0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0};
10
	struct netbuf nb;
11

    
12
	(void) memset(&nb, 0, sizeof nb);
13
	xdrmem_create(&xdrs, buf, sizeof buf, XDR_DECODE);
14
	if (!xdr_netbuf(&xdrs, &nb)) {
15
		(void) printf("xdr_netbuf() failed\n");
16
		return 1;
17
	}
18

    
19
	(void) printf("maxlen: %d\n", nb.maxlen);
20
	(void) printf("len: %d\n", nb.len);
21

    
22
	for (int i = 0; i < nb.maxlen; i++)
23
		nb.buf[i] = 0;
24

    
25
	return 0;
26
}
    (1-1/1)