From 46d22486379f050eab3fd9a8f850875162c5d65e Mon Sep 17 00:00:00 2001 From: ticktock35 Date: Sun, 14 Dec 2008 23:51:11 -0500 Subject: opkg: use strdup() to prevent memory corruption git-svn-id: http://opkg.googlecode.com/svn/trunk@38 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- (limited to 'libopkg') 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 { -- cgit v0.9.1