opkg: use strdup() to prevent memory corruption
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 04:51:11 +0000 (04:51 +0000)
committerticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 04:51:11 +0000 (04:51 +0000)
git-svn-id: http://opkg.googlecode.com/svn/trunk@38 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libopkg/opkg_state.c

index 2cc8594..d83b96b 100644 (file)
@@ -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
   {