aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-06-19 17:23:39 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-06-19 17:23:39 +0000
commiteba2af633fb8fa3b20ad578184d79e1f0eabcefe (patch)
treebcc44d0b0e8c36caa1c6701ce9362d009a01d0dd
parent95ce326e5b47b4b841849f8a2ac7b96d6e204dfb (diff)
buffer overflow fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@932 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--block.c2
-rw-r--r--linux-user/elfload.c2
-rw-r--r--target-i386/helper2.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/block.c b/block.c
index c1267888c8..e71adda191 100644
--- a/block.c
+++ b/block.c
@@ -92,7 +92,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int snapshot)
bs->fd = -1;
bs->cow_fd = -1;
bs->cow_bitmap = NULL;
- strcpy(bs->filename, filename);
+ pstrcpy(bs->filename, sizeof(bs->filename), filename);
/* open standard HD image */
#ifdef _WIN32
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 899e085c57..21261e2c0c 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1067,7 +1067,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * r
char * passed_p;
if (interpreter_type == INTERPRETER_AOUT) {
- sprintf(passed_fileno, "%d", bprm->fd);
+ snprintf(passed_fileno, sizeof(passed_fileno), "%d", bprm->fd);
passed_p = passed_fileno;
if (elf_interpreter) {
diff --git a/target-i386/helper2.c b/target-i386/helper2.c
index e0d917a738..1d5bdc17e4 100644
--- a/target-i386/helper2.c
+++ b/target-i386/helper2.c
@@ -212,7 +212,7 @@ void cpu_x86_dump_state(CPUX86State *env, FILE *f, int flags)
if (flags & X86_DUMP_CCOP) {
if ((unsigned)env->cc_op < CC_OP_NB)
- strcpy(cc_op_name, cc_op_str[env->cc_op]);
+ snprintf(cc_op_name, sizeof(cc_op_name), "%s", cc_op_str[env->cc_op]);
else
snprintf(cc_op_name, sizeof(cc_op_name), "[%d]", env->cc_op);
fprintf(f, "CCS=%08x CCD=%08x CCO=%-8s\n",