From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 29412A00E6 for ; Thu, 11 Jul 2019 13:57:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0463E1B956; Thu, 11 Jul 2019 13:57:12 +0200 (CEST) Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by dpdk.org (Postfix) with ESMTP id A1C141B945; Thu, 11 Jul 2019 13:57:08 +0200 (CEST) Received: by mail-pf1-f176.google.com with SMTP id m30so2651332pff.8; Thu, 11 Jul 2019 04:57:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=wObuBwweg+WPyATfoTPFSexOc6G0vrZYzpHILoSQO/c=; b=NC55YE+b+khoIByRrf8jvYKNu9oyp9S+UhGT3aRacS3aDP8+1/m96RslR8kK78VwIz VXqpDEa5IWfNU3WObOj+wSeDASDTGQa8GC/SWD+3/zL5EQOqMynPad3cWCxLqVtgIYkH nUUN6XEoiJ/G4BasKbHg/HigMdwVMaUcMvb5SarWpJ8az2jZrethtU/UQJa0CthiK73u OTsp0WsnPeb9+cAe3KywfYum3vhBVFt9RKMydN2jCDXb4Q5szLNWI2KuDKtoXD6yVpGG Icr9nr2hCMQbnJQcao6H3TWMGrLe5WLxBFhIj/EiXelTLZO6v1ynqSXB4oHFUYi6fKIW u+Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wObuBwweg+WPyATfoTPFSexOc6G0vrZYzpHILoSQO/c=; b=OCL2y6x7GxSKKBoXVOy+fqy71MdcdVc6uI4n6hfRUrkOYo1OiB1GoXaBg/Y1PP2ciD NfCD5/t2I5LfZmnOHcMVJ/x7ivk2tJaQWYTsXR1vy/7WfV0HqDlgpDvSEkl3qVRHXFrD mm6Ydj64CeugWxIrSXtdLFDzCX5JcHN6LLbhbjqCBc4Q7KDZWz1Qa8SxseprIoRBAVHz Qd8y4juqXH5vlxGdR40tUuPkgPVMuQeb169VETPKdFresWrwEalDbAWSjiFLQQ2CrC67 cXoR3iAHIa9WUEP3tPUD2HmMwSfDNzgU+Hnkd3n78NMQZFRPI1hrNnW5EVT2Gt/Q8K67 jhPQ== X-Gm-Message-State: APjAAAXjjDr/PKZbzQgvT0evkfXIbMNHI75yA3uwusSQbRD8QQ9NnCFZ N49MMA1RWRiPtl+n+5Zo0xk= X-Google-Smtp-Source: APXvYqwjGif8y7xuD3ULEclFq8MrBD16KhzgqvtZnjVmxJpv06E3e3fV4tjY2AXG3FTmYXCHhTKBjA== X-Received: by 2002:a17:90a:3544:: with SMTP id q62mr4474269pjb.53.1562846227935; Thu, 11 Jul 2019 04:57:07 -0700 (PDT) Received: from mugwort.local ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id z13sm4608855pjn.32.2019.07.11.04.57.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jul 2019 04:57:07 -0700 (PDT) To: "Burakov, Anatoly" , david.marchand@redhat.com Cc: dev@dpdk.org, stable@dpdk.org, Yasufumi Ogawa References: <1555379952-23517-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> <20190711103148.9187-1-yasufum.o@gmail.com> <20190711103148.9187-2-yasufum.o@gmail.com> From: Yasufumi Ogawa Message-ID: Date: Thu, 11 Jul 2019 20:57:04 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-stable] [PATCH v3 1/1] fbarray: get fbarrays from containerized secondary X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On 2019/07/11 19:53, Burakov, Anatoly wrote: > On 11-Jul-19 11:31 AM, yasufum.o@gmail.com wrote: >> From: Yasufumi Ogawa >> > <...> > >> +    if (getpid() == 1) { >> +        FILE *hn_fp; >> +        hn_fp = fopen("/etc/hostname", "r"); >> +        if (hn_fp == NULL) { >> +            RTE_LOG(ERR, EAL, >> +                "Cannot open '/etc/hostname' for secondary\n"); >> +            return -1; >> +        } >> + >> +        /* with docker, /etc/hostname just has one entry of hostname */ >> +        if (fscanf(hn_fp, "%s", proc_id) == EOF) { > > Apologies for not pointing this out earlier, but do i understand > correctly that there's no bounds checking here, and fscanf() will write > however many bytes it wants? I understand "%s" is not appropriate. hostname is 12 bytes char and I thought proc_id[16] is enough, but it is unsafe. In addition, hostname can be defined by user with docker's option, so it should be enough for user defined name. How do you think expecting max 32 chars of hostname and set boundary "%32s" as following? proc_id[33]; /* define proc id from hostname less than 33 bytes. */ ... if (fscanf(hn_fp, "%32s", proc_id) == EOF) { Thanks, Yasufumi