Message ID | 53C918D3.7060908@acm.org (mailing list archive) |
---|---|
State | Not Applicable, archived |
Delegated to: | Mike Snitzer |
Headers | show
Return-Path: <dm-devel-bounces@redhat.com> X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7ABE9C0514 for <patchwork-dm-devel@patchwork.kernel.org>; Fri, 18 Jul 2014 12:57:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD13A2011E for <patchwork-dm-devel@patchwork.kernel.org>; Fri, 18 Jul 2014 12:57:36 +0000 (UTC) Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mail.kernel.org (Postfix) with ESMTP id 01BDC200D9 for <patchwork-dm-devel@patchwork.kernel.org>; Fri, 18 Jul 2014 12:57:35 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6ICrkcf004463; Fri, 18 Jul 2014 08:53:46 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s6ICri4l029714 for <dm-devel@listman.util.phx.redhat.com>; Fri, 18 Jul 2014 08:53:44 -0400 Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.19]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6ICri8o019215 for <dm-devel@redhat.com>; Fri, 18 Jul 2014 08:53:44 -0400 Received: from sf2.bxl.stone.is (sf2.bxl.stone.is [5.134.1.239]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6ICrgsd024920 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for <dm-devel@redhat.com>; Fri, 18 Jul 2014 08:53:43 -0400 Received: from [87.238.167.34] (helo=smtprelay.1eurohost.com) by sf2.bxl.stone.is with esmtp (Exim 4.82) (envelope-from <bvanassche@acm.org>) id 1X87fR-0005Fn-8c; Fri, 18 Jul 2014 14:53:43 +0200 Received: from vz19.stone-is.net (vz19.stone-is.net [87.238.162.57]) by smtprelay.1eurohost.com (Postfix) with ESMTP id 1778B22088A; Fri, 18 Jul 2014 14:53:40 +0200 (CEST) X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network Received: from [192.168.1.117] (178-119-65-67.access.telenet.be [178.119.65.67]) by vz19.stone-is.net (Postfix) with ESMTPSA id 2165089203; Fri, 18 Jul 2014 14:53:41 +0200 (CEST) Message-ID: <53C918D3.7060908@acm.org> Date: Fri, 18 Jul 2014 14:53:39 +0200 From: Bart Van Assche <bvanassche@acm.org> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: christophe.varoqui@opensvc.com References: <53C91871.9070402@acm.org> In-Reply-To: <53C91871.9070402@acm.org> X-Enigmail-Version: 1.6 X-Filter-ID: XtLePq6GTMn8G68F0EmQvdthj6rk7ohlAkaRQG+cDaLZlN3ufQ0ZRHdy43341LQ0JYRGiu4wDuX/ sGw1Y7RAsQVCOi2K3ZygpdQwUC1xM8uHTLHcW1YhPsFnFxvjWlQPLZy1RAw8+2yZuh2VuYuU9z8U a6+MdljsDo+RKX0yPPDwoVJnpeAWJjfTvWCbG36LwJOqJV51iSPXek1m27w/m+HNZvRbeH/WodDC Pyd1hEHbiTiodCOnGJJ238+JDuVL3l8j2L9cipLwtd7/k/XWIH9T+OwfgRcaB9RPsshfI97D4gz4 tcU5YI1KNYsC2/V3glLeZCD1voA8s0bkUEtPw/GX+ObfaU6whL8xq/xH+as21Cee63EeltfbuaMM NA5XR/lhzJ4Pd6XOYPUh1LatWl4K/BrAvODv+H53lohFBx5WhVa6zifUH6X26a/6lVhrtJVcNrFf 4GaM5Eg5slNOY1NHQAvSZpDy3ysxabiXOiY8rN5kPduYoOjRk/4SxcBWjjQNtXRKSR1sOD289304 szpgkzbBMkWtGTUmSRdnNNTqrNZ1EgtZond7q2FKC0V2DjB8+DxmdJyMgaP/BJhXML08KlEIRB/1 zhErtZP4jFj74O4hBSz/kkmPgL+fgIguP7zVxQ8/MinsvL3XSVaM87zsNy3vhxHFEhzEUW2s4y8l G+iucR8wMCVHyHsimo/bhMIZHdSilwF/ZU2dwKqv4A== X-Report-Abuse-To: spam@sf1.bxl.stone.is X-Filter-Fingerprint: cPaH8lomer6UwsJ3BnJDysg56Hzi1baYmi2c/60G48S0VFDyP20las9Mq1v6nXmfrqKtWpHLpkE8 c09GKJn2tyeR21gZ7lPyhry6OdD/cBzd1PHxHTVUQ6kKwyUfwBkXbbcemmvc6LV6reHAmFfSz0ej vfBM5HDil32B6EA6ECAwtB2mFrRhH9FyTxY8sWyBGizJrj8xn8+CIlOwD7rpPJjp2wMQvksbXuh+ Zur/YDgNaJU0bkU579fapNXDRWH7lv8Ffx5tjiiMQ9xvR0covSWj1kd0N16AJIzbHn3urryUOSbt rhiR0dBuPv/XixcLgZGW1Q2YRaufTGd4ws178yPYyJcSxqgomQSxLG/IqKJmLcRjbh4tt+C7QLi/ d0JLh7cxcjsgBTxNJWWHM9ZBsyb0iDyxIyoedIlOoGOP+kg4WNW5IE3LlEe0p1AaVStrnfW5fBRH 93BuV4EXYIb6Ew== X-Originating-IP: 87.238.167.34 X-SpamExperts-Domain: stone.is X-SpamExperts-Username: 87.238.167.34 Authentication-Results: bxl.stone.is; auth=pass smtp.auth=87.238.167.34 X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.03) X-Recommended-Action: accept X-RedHat-Spam-Score: -1.235 (BAYES_00,SPF_SOFTFAIL) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.19 X-loop: dm-devel@redhat.com Cc: device-mapper development <dm-devel@redhat.com>, Sebastian Herbszt <herbszt@gmx.de> Subject: [dm-devel] [PATCH 3/5] libmultipath: Zero-terminate sysfs_attr_get_value() result X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development <dm-devel@redhat.com> List-Id: device-mapper development <dm-devel.redhat.com> List-Unsubscribe: <https://www.redhat.com/mailman/options/dm-devel>, <mailto:dm-devel-request@redhat.com?subject=unsubscribe> List-Archive: <https://www.redhat.com/archives/dm-devel> List-Post: <mailto:dm-devel@redhat.com> List-Help: <mailto:dm-devel-request@redhat.com?subject=help> List-Subscribe: <https://www.redhat.com/mailman/listinfo/dm-devel>, <mailto:dm-devel-request@redhat.com?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c index e5834f9..f42cda8 100644 --- a/libmultipath/sysfs.c +++ b/libmultipath/sysfs.c @@ -88,6 +88,8 @@ ssize_t sysfs_attr_get_value(struct udev_device *dev, const char *attr_name, } else if (size == value_len) { condlog(4, "overflow while reading from %s", devpath); size = 0; + } else { + value[size] = '\0'; } close(fd);
The callers of sysfs_attr_get_value() expect a '\0'-terminated string. Hence terminate the string returned by this function with '\0'. Detected by Valgrind. Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- libmultipath/sysfs.c | 2 ++ 1 file changed, 2 insertions(+)