net: stellaris_enet: check packet length against receive buffer
[qemu/ar7.git] / fsdev / 9p-marshal.c
blob183d3667c68170e2193367a7bcf02b032eda9aaa
1 /*
2 * 9p backend
4 * Copyright IBM, Corp. 2010
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #include "qemu/osdep.h"
15 #include <glib.h>
16 #include <glib/gprintf.h>
17 #include <dirent.h>
18 #include <utime.h>
19 #include <sys/uio.h>
21 #include "9p-marshal.h"
23 void v9fs_string_free(V9fsString *str)
25 g_free(str->data);
26 str->data = NULL;
27 str->size = 0;
30 void v9fs_string_null(V9fsString *str)
32 v9fs_string_free(str);
35 void GCC_FMT_ATTR(2, 3)
36 v9fs_string_sprintf(V9fsString *str, const char *fmt, ...)
38 va_list ap;
40 v9fs_string_free(str);
42 va_start(ap, fmt);
43 str->size = g_vasprintf(&str->data, fmt, ap);
44 va_end(ap);
47 void v9fs_string_copy(V9fsString *lhs, V9fsString *rhs)
49 v9fs_string_free(lhs);
50 v9fs_string_sprintf(lhs, "%s", rhs->data);