diff -r f1fec38c8228 tools/blktap2/include/blk_uuid.h --- a/tools/blktap2/include/blk_uuid.h Wed Jun 24 14:03:20 2009 +0100 +++ b/tools/blktap2/include/blk_uuid.h Wed Jun 24 15:45:27 2009 +0200 @@ -45,7 +45,7 @@ static inline void blk_uuid_generate(blk uuid_generate(uuid->uuid); } -static inline void blk_uuid_to_string(blk_uuid_t *uuid, char *out) +static inline void blk_uuid_to_string(blk_uuid_t *uuid, char *out, size_t size) { uuid_unparse(uuid->uuid, out); } @@ -74,6 +74,7 @@ static inline int blk_uuid_compare(blk_u #include #include +#include typedef uuid_t blk_uuid_t; @@ -89,10 +90,13 @@ static inline void blk_uuid_generate(blk uuid_create((uuid_t *)uuid, &status); } -static inline void blk_uuid_to_string(blk_uuid_t *uuid, char *out) +static inline void blk_uuid_to_string(blk_uuid_t *uuid, char *out, size_t size) { uint32_t status; - uuid_to_string((uuid_t *)uuid, &out, &status); + char *_out = NULL; + uuid_to_string((uuid_t *)uuid, &_out, &status); + strlcpy(out, _out, size); + free(_out); } static inline void blk_uuid_from_string(blk_uuid_t *uuid, const char *in) diff -r f1fec38c8228 tools/blktap2/vhd/lib/libvhd.c --- a/tools/blktap2/vhd/lib/libvhd.c Wed Jun 24 14:03:20 2009 +0100 +++ b/tools/blktap2/vhd/lib/libvhd.c Wed Jun 24 15:45:27 2009 +0200 @@ -1335,7 +1335,7 @@ vhd_macx_encode_location(char *name, cha snprintf(uri, ibl+1, "file://%s", name); if (iconv(cd, -#if defined(__linux__) || (__Linux__) +#if defined(__linux__) || defined(__Linux__) (char **) #endif &urip, &ibl, &uri_utf8p, &obl) == (size_t)-1 || @@ -1425,7 +1425,7 @@ vhd_w2u_encode_location(char *name, char } if (iconv(cd, -#if defined(__linux__) || (__Linux__) +#if defined(__linux__) || defined(__Linux__) (char **) #endif &urip, &ibl, &uri_utf16p, &obl) == (size_t)-1 || diff -r f1fec38c8228 tools/blktap2/vhd/lib/vhd-util-read.c --- a/tools/blktap2/vhd/lib/vhd-util-read.c Wed Jun 24 14:03:20 2009 +0100 +++ b/tools/blktap2/vhd/lib/vhd-util-read.c Wed Jun 24 15:45:27 2009 +0200 @@ -78,7 +78,7 @@ vhd_print_header(vhd_context_t *vhd, vhd (err ? "failed to read name" : name)); free(name); - blk_uuid_to_string(&h->prt_uuid, uuid); + blk_uuid_to_string(&h->prt_uuid, uuid, sizeof(uuid)); printf("Parent UUID : %s\n", uuid); vhd_time_to_string(h->prt_ts, time_str); @@ -153,7 +153,7 @@ vhd_print_footer(vhd_footer_t *f, int he printf("Checksum : 0x%x|0x%x (%s)\n", f->checksum, cksm, f->checksum == cksm ? "Good!" : "Bad!"); - blk_uuid_to_string(&f->uuid, uuid); + blk_uuid_to_string(&f->uuid, uuid, sizeof(uuid)); printf("UUID : %s\n", uuid); printf("Saved state : %s\n", f->saved == 0 ? "No" : "Yes");