{"id":808820,"url":"http://patchwork.ozlabs.org/api/1.0/patches/808820/?format=json","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.0/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20170901165256.21459-7-phil@nwl.cc>","date":"2017-09-01T16:52:56","name":"[iproute,6/6] lnstat_util: Make sure buffer is NUL-terminated","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"5a94107b55f0deda9d3f14cc85657922bf0b1439","submitter":{"id":4285,"url":"http://patchwork.ozlabs.org/api/1.0/people/4285/?format=json","name":"Phil Sutter","email":"phil@nwl.cc"},"delegate":{"id":389,"url":"http://patchwork.ozlabs.org/api/1.0/users/389/?format=json","username":"shemminger","first_name":"stephen","last_name":"hemminger","email":"shemminger@vyatta.com"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170901165256.21459-7-phil@nwl.cc/mbox/","series":[{"id":1076,"url":"http://patchwork.ozlabs.org/api/1.0/series/1076/?format=json","date":"2017-09-01T16:52:50","name":"strlcpy() and strlcat() for iproute2","version":1,"mbox":"http://patchwork.ozlabs.org/series/1076/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808820/checks/","tags":{},"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xkQL95J4nz9t2x\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat,  2 Sep 2017 02:53:37 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752196AbdIAQxe (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 1 Sep 2017 12:53:34 -0400","from orbyte.nwl.cc ([151.80.46.58]:36895 \"EHLO mail.nwl.cc\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1752148AbdIAQxe (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tFri, 1 Sep 2017 12:53:34 -0400","from mail.nwl.cc (orbyte.nwl.cc [127.0.0.1])\n\tby mail.nwl.cc (Postfix) with ESMTP id 094C165A5E;\n\tFri,  1 Sep 2017 18:53:33 +0200 (CEST)","from xsao (localhost [IPv6:::1])\n\tby mail.nwl.cc (Postfix) with ESMTP id DFC97644CF;\n\tFri,  1 Sep 2017 18:53:32 +0200 (CEST)"],"From":"Phil Sutter <phil@nwl.cc>","To":"Stephen Hemminger <stephen@networkplumber.org>","Cc":"netdev@vger.kernel.org","Subject":"[iproute PATCH 6/6] lnstat_util: Make sure buffer is NUL-terminated","Date":"Fri,  1 Sep 2017 18:52:56 +0200","Message-Id":"<20170901165256.21459-7-phil@nwl.cc>","X-Mailer":"git-send-email 2.13.1","In-Reply-To":"<20170901165256.21459-1-phil@nwl.cc>","References":"<20170901165256.21459-1-phil@nwl.cc>","X-Virus-Scanned":"ClamAV using ClamSMTP","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"Can't use strlcpy() here since lnstat is not linked against libutil.\n\nWhile being at it, fix coding style in that chunk as well.\n\nSigned-off-by: Phil Sutter <phil@nwl.cc>\n---\n misc/lnstat_util.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)","diff":"diff --git a/misc/lnstat_util.c b/misc/lnstat_util.c\nindex ec19238c24b94..c2dc42ec1ff12 100644\n--- a/misc/lnstat_util.c\n+++ b/misc/lnstat_util.c\n@@ -150,7 +150,8 @@ static int lnstat_scan_compat_rtstat_fields(struct lnstat_file *lf)\n {\n \tchar buf[FGETS_BUF_SIZE];\n \n-\tstrncpy(buf, RTSTAT_COMPAT_LINE, sizeof(buf)-1);\n+\tstrncpy(buf, RTSTAT_COMPAT_LINE, sizeof(buf) - 1);\n+\tbuf[sizeof(buf) - 1] = '\\0';\n \n \treturn __lnstat_scan_fields(lf, buf);\n }\n","prefixes":["iproute","6/6"]}