Patchwork [09/12] lib: fwts_acpica: use strncpy, strncat instead of strcpy, strcat

login
register
mail settings
Submitter Colin King
Date Nov. 4, 2012, 10:19 p.m.
Message ID <1352067590-11820-10-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/197107/
State Rejected
Headers show

Comments

Colin King - Nov. 4, 2012, 10:19 p.m.
From: Colin Ian King <colin.king@canonical.com>

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpica/fwts_acpica.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c
index 4e28d60..d65bf8b 100644
--- a/src/acpica/fwts_acpica.c
+++ b/src/acpica/fwts_acpica.c
@@ -503,14 +503,14 @@  void fwts_acpica_vprintf(const char *fmt, va_list args)
 		buffer_len = tmp_len + 1;
 		buffer = malloc(buffer_len);
 		if (buffer)
-			strcpy(buffer, tmp);
+			strncpy(buffer, tmp, buffer_len);
 		else
 			buffer_len = 0;
 	} else {
 		buffer_len += tmp_len;
 		buffer = realloc(buffer, buffer_len);
 		if (buffer)
-			strcat(buffer, tmp);
+			strncat(buffer, tmp, buffer_len);
 		else
 			buffer_len = 0;
 	}