aboutsummaryrefslogtreecommitdiff
path: root/block-vmdk.c
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-08-21 17:58:08 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-08-21 17:58:08 +0000
commit363a37d52016e0a16e3599d690f610346fc6898a (patch)
tree35ce1129736b9c6833c2e5eda5c6015b7897c67f /block-vmdk.c
parentc93e7817ee963d9441f6706d6f194ff02cec690f (diff)
downloadqemu-363a37d52016e0a16e3599d690f610346fc6898a.zip
qemu-363a37d52016e0a16e3599d690f610346fc6898a.tar.gz
qemu-363a37d52016e0a16e3599d690f610346fc6898a.tar.bz2
Fix OpenBSD linker warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5044 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block-vmdk.c')
-rw-r--r--block-vmdk.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/block-vmdk.c b/block-vmdk.c
index 7eb9c3c..e85bd42 100644
--- a/block-vmdk.c
+++ b/block-vmdk.c
@@ -153,11 +153,11 @@ static int vmdk_write_cid(BlockDriverState *bs, uint32_t cid)
return -1;
tmp_str = strstr(desc,"parentCID");
- strcpy(tmp_desc, tmp_str);
+ pstrcpy(tmp_desc, sizeof(tmp_desc), tmp_str);
if ((p_name = strstr(desc,"CID")) != 0) {
p_name += sizeof("CID");
- sprintf(p_name,"%x\n",cid);
- strcat(desc,tmp_desc);
+ snprintf(p_name, sizeof(desc) - (p_name - desc), "%x\n", cid);
+ pstrcat(desc, sizeof(desc), tmp_desc);
}
if (bdrv_pwrite(s->hd, 0x200, desc, DESC_SIZE) != DESC_SIZE)
@@ -252,8 +252,8 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file)
if ((temp_str = strrchr(real_filename, ':')) != NULL)
real_filename = temp_str + 1;
- sprintf(s_desc, desc_template, p_cid, p_cid, backing_file
- , (uint32_t)header.capacity, real_filename);
+ snprintf(s_desc, sizeof(s_desc), desc_template, p_cid, p_cid, backing_file,
+ (uint32_t)header.capacity, real_filename);
/* write the descriptor */
if (lseek(snp_fd, 0x200, SEEK_SET) == -1)
@@ -349,7 +349,8 @@ static int vmdk_parent_open(BlockDriverState *bs, const char * filename)
path_combine(parent_img_name, sizeof(parent_img_name),
filename, s->hd->backing_file);
} else {
- strcpy(parent_img_name, s->hd->backing_file);
+ pstrcpy(parent_img_name, sizeof(parent_img_name),
+ s->hd->backing_file);
}
s->hd->backing_hd = bdrv_new("");
@@ -790,8 +791,8 @@ static int vmdk_create(const char *filename, int64_t total_size,
real_filename = temp_str + 1;
if ((temp_str = strrchr(real_filename, ':')) != NULL)
real_filename = temp_str + 1;
- sprintf(desc, desc_template, time(NULL), (unsigned long)total_size,
- real_filename, (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), total_size / (63 * 16));
+ snprintf(desc, sizeof(desc), desc_template, time(NULL), (unsigned long)total_size,
+ real_filename, (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), total_size / (63 * 16));
/* write the descriptor */
lseek(fd, le64_to_cpu(header.desc_offset) << 9, SEEK_SET);