From 46d22486379f050eab3fd9a8f850875162c5d65e Mon Sep 17 00:00:00 2001 From: ticktock35 Date: Mon, 15 Dec 2008 04:51:11 +0000 Subject: [PATCH] opkg: use strdup() to prevent memory corruption git-svn-id: http://opkg.googlecode.com/svn/trunk@38 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- libopkg/opkg_state.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libopkg/opkg_state.c b/libopkg/opkg_state.c index 2cc8594..d83b96b 100644 --- a/libopkg/opkg_state.c +++ b/libopkg/opkg_state.c @@ -45,8 +45,7 @@ opkg_set_current_state (opkg_state_t state, const char *data) free (opkg_state_data); if (data) { - opkg_state_data = malloc (strlen (data)); - strcpy (opkg_state_data, data); + opkg_state_data = strdup (data); } else { -- 2.25.1