From: ticktock35 Date: Mon, 15 Dec 2008 04:51:11 +0000 (+0000) Subject: opkg: use strdup() to prevent memory corruption X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=46d22486379f050eab3fd9a8f850875162c5d65e;p=oweals%2Fopkg-lede.git opkg: use strdup() to prevent memory corruption git-svn-id: http://opkg.googlecode.com/svn/trunk@38 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- 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 {