From patchwork Wed May 9 17:54:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 158020 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) by ozlabs.org (Postfix) with ESMTP id 66A47B6FA5 for ; Thu, 10 May 2012 03:54:33 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 8B8429D25E; Wed, 9 May 2012 13:54:31 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ViSBKzc0xQCS; Wed, 9 May 2012 13:54:31 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 89C769D260; Wed, 9 May 2012 13:54:26 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id E13709D260 for ; Wed, 9 May 2012 13:54:24 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cfj21VsIyA0Q for ; Wed, 9 May 2012 13:54:20 -0400 (EDT) Received: from ns3.lanforge.com (mail.candelatech.com [208.74.158.172]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id F22889D25E for ; Wed, 9 May 2012 13:54:19 -0400 (EDT) Received: from fs3.candelatech.com (firewall.candelatech.com [70.89.124.249]) by ns3.lanforge.com (8.14.2/8.14.2) with ESMTP id q49Hs7k2012242 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 9 May 2012 10:54:07 -0700 From: greearb@candelatech.com To: hostap@lists.shmoo.com Subject: [PATCH] wpa_supplicant: Fix invalid memcpy. Date: Wed, 9 May 2012 10:54:01 -0700 Message-Id: <1336586041-17444-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 1.7.3.4 Cc: Ben Greear X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Ben Greear I think this should fix the following valgrind complaint: ==1972== Source and destination overlap in memcpy(0x5181708, 0x5181708, 16) ==1972== at 0x4A073BA: memcpy (mc_replace_strmem.c:602) ==1972== by 0x45872B: wpas_wps_set_uuid (wps_supplicant.c:1116) ==1972== by 0x4599EC: wpas_wps_update_config (wps_supplicant.c:1747) ==1972== by 0x4C8DB0: wpa_supplicant_update_config (wpa_supplicant.c:3090) ==1972== by 0x4C3E5E: wpa_supplicant_reload_configuration (wpa_supplicant.c:746) ==1972== by 0x4B8B37: wpa_supplicant_ctrl_iface_process (ctrl_iface.c:4082) ==1972== by 0x4BA39C: wpa_supplicant_ctrl_iface_receive (ctrl_iface_unix.c:168) ==1972== by 0x4114D4: eloop_sock_table_dispatch_table (eloop.c:335) ==1972== by 0x411541: eloop_sock_table_dispatch (eloop.c:352) ==1972== by 0x41200D: eloop_run (eloop.c:766) ==1972== by 0x4C8B43: wpa_supplicant_run (wpa_supplicant.c:3010) ==1972== by 0x4D44AD: main (main.c:286) Signed-hostap: Ben Greear --- wpa_supplicant/wps_supplicant.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c index 00ce9be..da4421c 100644 --- a/wpa_supplicant/wps_supplicant.c +++ b/wpa_supplicant/wps_supplicant.c @@ -1113,8 +1113,10 @@ static void wpas_wps_set_uuid(struct wpa_supplicant *wpa_s, while (first && first->next) first = first->next; if (first && first != wpa_s) { - os_memcpy(wps->uuid, wpa_s->global->ifaces->wps->uuid, - WPS_UUID_LEN); + /* Only copy if memory locations are actually different */ + if (wps != wpa_s->global->ifaces->wps) + os_memcpy(wps->uuid, wpa_s->global->ifaces->wps->uuid, + WPS_UUID_LEN); wpa_hexdump(MSG_DEBUG, "WPS: UUID from the first " "interface", wps->uuid, WPS_UUID_LEN); } else {