diff options
author | M. Mohan Kumar <mohan@in.ibm.com> | 2011-12-14 13:49:13 +0530 |
---|---|---|
committer | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2012-01-04 19:53:22 +0530 |
commit | ddca7f86ac022289840e0200fd4050b2b58e9176 (patch) | |
tree | f856073b2780d8161fbbe795c481944d3d0c189f /fsdev/virtio-9p-marshal.h | |
parent | 10925bf089024eb5157e78618a5d8864e29f243e (diff) |
hw/9pfs: Add validation to {un}marshal code
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Diffstat (limited to 'fsdev/virtio-9p-marshal.h')
-rw-r--r-- | fsdev/virtio-9p-marshal.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/fsdev/virtio-9p-marshal.h b/fsdev/virtio-9p-marshal.h index f4414006dc..5df65a8357 100644 --- a/fsdev/virtio-9p-marshal.h +++ b/fsdev/virtio-9p-marshal.h @@ -71,17 +71,20 @@ typedef struct V9fsStatDotl { uint64_t st_data_version; } V9fsStatDotl; -extern void v9fs_string_init(V9fsString *str); +static inline void v9fs_string_init(V9fsString *str) +{ + str->data = NULL; + str->size = 0; +} extern void v9fs_string_free(V9fsString *str); extern void v9fs_string_null(V9fsString *str); extern void v9fs_string_sprintf(V9fsString *str, const char *fmt, ...); extern void v9fs_string_copy(V9fsString *lhs, V9fsString *rhs); -size_t v9fs_pack(struct iovec *in_sg, int in_num, size_t offset, - const void *src, size_t size); -size_t v9fs_unmarshal(struct iovec *out_sg, int out_num, size_t offset, - int bswap, const char *fmt, ...); -size_t v9fs_marshal(struct iovec *in_sg, int in_num, size_t offset, - int bswap, const char *fmt, ...); - +ssize_t v9fs_pack(struct iovec *in_sg, int in_num, size_t offset, + const void *src, size_t size); +ssize_t v9fs_unmarshal(struct iovec *out_sg, int out_num, size_t offset, + int bswap, const char *fmt, ...); +ssize_t v9fs_marshal(struct iovec *in_sg, int in_num, size_t offset, + int bswap, const char *fmt, ...); #endif |