From patchwork Thu Jul 5 14:21:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baruch Siach X-Patchwork-Id: 169606 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 072A82C0084 for ; Sun, 8 Jul 2012 05:05:50 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 835199C1AC; Sat, 7 Jul 2012 15:05:46 -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 6EyZCimL4zaB; Sat, 7 Jul 2012 15:05:46 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 7C7F79C1A2; Sat, 7 Jul 2012 15:05:38 -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 42C199C1A1 for ; Sat, 7 Jul 2012 15:05:37 -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 bRmPjNdkOIZT for ; Sat, 7 Jul 2012 15:05:29 -0400 (EDT) Received: from sivan.tkos.co.il (guitar.tcltek.co.il [192.115.133.116]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 8F99D9C19A for ; Sat, 7 Jul 2012 15:05:29 -0400 (EDT) Received: from sapphire.alvarion.com (taragon.tkos.co.il [10.0.4.3]) by sivan.tkos.co.il (Postfix) with ESMTP id 84EC2B4FBF; Thu, 5 Jul 2012 17:21:14 +0300 (IDT) From: Baruch Siach To: hostap@lists.shmoo.com Subject: [PATCH] ieee802_1x: remove useless NULL terminations Date: Thu, 5 Jul 2012 17:21:07 +0300 Message-Id: X-Mailer: git-send-email 1.7.10 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 snprintf() is guaranteed to terminate its destination string. Signed-hostap: Baruch Siach --- src/ap/ieee802_1x.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c index dd0df1d..7544027 100644 --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c @@ -482,7 +482,6 @@ static void ieee802_1x_encapsulate_radius(struct hostapd_data *hapd, os_snprintf(buf, sizeof(buf), RADIUS_802_1X_ADDR_FORMAT ":%s", MAC2STR(hapd->own_addr), hapd->conf->ssid.ssid); - buf[sizeof(buf) - 1] = '\0'; if (!hostapd_config_get_radius_attr(hapd->conf->radius_auth_req_attr, RADIUS_ATTR_CALLED_STATION_ID) && !radius_msg_add_attr(msg, RADIUS_ATTR_CALLED_STATION_ID, @@ -493,7 +492,6 @@ static void ieee802_1x_encapsulate_radius(struct hostapd_data *hapd, os_snprintf(buf, sizeof(buf), RADIUS_802_1X_ADDR_FORMAT, MAC2STR(sta->addr)); - buf[sizeof(buf) - 1] = '\0'; if (!radius_msg_add_attr(msg, RADIUS_ATTR_CALLING_STATION_ID, (u8 *) buf, os_strlen(buf))) { printf("Could not add Calling-Station-Id\n"); @@ -526,7 +524,6 @@ static void ieee802_1x_encapsulate_radius(struct hostapd_data *hapd, radius_sta_rate(hapd, sta) / 2, (radius_sta_rate(hapd, sta) & 1) ? ".5" : "", radius_mode_txt(hapd)); - buf[sizeof(buf) - 1] = '\0'; } if (!hostapd_config_get_radius_attr(hapd->conf->radius_auth_req_attr, RADIUS_ATTR_CONNECT_INFO) &&