diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-06-07 16:27:29 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-06-07 16:27:29 +0000 |
commit | 5c4f07cdc71a90896a777d7baad8d2046b9a2bfa (patch) | |
tree | af8a49e0b7c7954df98a1470d4ea21d2af6b1f90 | |
parent | 13b3440740a23056bf2bf59c2d7840765b7ab0cc (diff) |
strlcpy cleanup; cloder ok
-rw-r--r-- | usr.sbin/acpidump/aml/aml_obj.c | 12 | ||||
-rw-r--r-- | usr.sbin/acpidump/aml/aml_store.c | 7 |
2 files changed, 10 insertions, 9 deletions
diff --git a/usr.sbin/acpidump/aml/aml_obj.c b/usr.sbin/acpidump/aml/aml_obj.c index 012316fec20..5589bb379b3 100644 --- a/usr.sbin/acpidump/aml/aml_obj.c +++ b/usr.sbin/acpidump/aml/aml_obj.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aml_obj.c,v 1.2 2005/06/03 19:59:04 grange Exp $ */ +/* $OpenBSD: aml_obj.c,v 1.3 2005/06/07 16:27:03 deraadt Exp $ */ /*- * Copyright (c) 1999 Takanori Watanabe * Copyright (c) 1999, 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org> @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: aml_obj.c,v 1.2 2005/06/03 19:59:04 grange Exp $ + * $Id: aml_obj.c,v 1.3 2005/06/07 16:27:03 deraadt Exp $ * $FreeBSD: src/usr.sbin/acpi/amldb/aml/aml_obj.c,v 1.3 2000/11/09 06:24:45 iwasaki Exp $ */ @@ -95,9 +95,9 @@ aml_copy_object(struct aml_environ *env, union aml_object *orig) ret->package.objects[i] = aml_copy_object(env, orig->package.objects[i]); } } else if (orig->type == aml_t_string && orig->str.needfree != 0) { - ret->str.string = memman_alloc_flexsize(aml_memman, - strlen(orig->str.string) + 1); - strcpy(orig->str.string, ret->str.string); + int l = strlen(orig->str.string) + 1; + ret->str.string = memman_alloc_flexsize(aml_memman, l); + strlcpy(orig->str.string, ret->str.string, l); } else if (orig->type == aml_t_num) { ret->num.constant = 0; } @@ -244,7 +244,7 @@ aml_realloc_object(union aml_object *obj, int size) return; } tmp.str.string = memman_alloc_flexsize(aml_memman, size + 1); - strcpy(tmp.str.string, obj->str.string); + strlcpy(tmp.str.string, obj->str.string, size + 1); aml_free_objectcontent(obj); *obj = tmp; break; diff --git a/usr.sbin/acpidump/aml/aml_store.c b/usr.sbin/acpidump/aml/aml_store.c index 0fcae246eff..519af72a675 100644 --- a/usr.sbin/acpidump/aml/aml_store.c +++ b/usr.sbin/acpidump/aml/aml_store.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aml_store.c,v 1.1 2005/06/02 20:09:39 tholo Exp $ */ +/* $OpenBSD: aml_store.c,v 1.2 2005/06/07 16:27:28 deraadt Exp $ */ /*- * Copyright (c) 1999 Takanori Watanabe * Copyright (c) 1999, 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org> @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: aml_store.c,v 1.1 2005/06/02 20:09:39 tholo Exp $ + * $Id: aml_store.c,v 1.2 2005/06/07 16:27:28 deraadt Exp $ * $FreeBSD: src/usr.sbin/acpi/amldb/aml/aml_store.c,v 1.3 2000/11/09 06:24:45 iwasaki Exp $ */ @@ -158,7 +158,8 @@ aml_store_to_buffer(struct aml_environ *env, union aml_object *obj, if (buf->buffer.size - offset < size) { aml_realloc_object(buf, offset + size + 1); } - strcpy(&buf->buffer.data[offset], obj->str.string); + strlcpy(&buf->buffer.data[offset], obj->str.string, + offset + size + 1); AML_DEBUGPRINT("[Store string to buffer]"); break; case aml_t_buffer: |