Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1093817pxm; Wed, 23 Feb 2022 17:59:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJ7E+4XjuoaSVonxzjaUhA5wIuH4A0gfesIrsfKBxdNnrTDMDj4OklcCQ5siCG/VbbM73W X-Received: by 2002:a05:6a00:22c8:b0:4e1:cb76:2e58 with SMTP id f8-20020a056a0022c800b004e1cb762e58mr640116pfj.47.1645667975214; Wed, 23 Feb 2022 17:59:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645667975; cv=none; d=google.com; s=arc-20160816; b=FyVq91ExMI8DDtUrjidhzYqitFOMCVSGKJWOPLPQ2H/cy07w4EUE4qFY+5TbOUobj+ 16PyZZl3Y7pSZK7exIAYz9IysUA7SNonfdt0hii8LYAdWcAeeJwygFmzWomCdvdxMJbx 8dDgjkxoCAepJ+zc3Twgm1WQGybPB4lWqDvWN+0o1zWYTOdkUZ3jIrmSUshLbVsd+63q KHEtU7/dXBx0iEIH0DQGZFokjLRWbAKJBcMa1bWsaG+bvmqxne+R6IB0AprXmU5MEwUa pBfwdSD53aPKR+WhB1Z26k2Fuqdc68EVgpi4Wo2ZHiSnOofHmOQl1MVSDUzUkeg/Ispk 6OQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=u8kVwqcjIrD5zUdSjqNqhAiLPf0+xMjZB8/slyK3y54=; b=zqQ5/FNkrjA+1ZkWm4AoS9JYHT5XinekYWT6aKHP246JUueiGHcjIbdfj2edJhyiek 118eAdGp6nFJf0aoCi7UHNzzjepwdSKnZT5+YUl1pk+bwm+nwTyVKbhGY94rw/ajrClh /eNwJWAUuP3p4/Nde2Ln2JFPb7q6fhkf+fIsAawFtFKI5Od3tGVYuXchcBhTYE1vz+7g +MrgUiTTAYreetMOUC+LUEP4haqbKbu78csjK569dqn45PLt6z+MkGeR+ig0ImruXqKh dNC+NSJrH1ZP3g6KYUuzo1ykwEpxJSDdDFKxvUMWMTNonYUTYigN9IelkmcC/0NazlJ+ i9BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ETX16i3d; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q24si1211868pgg.563.2022.02.23.17.59.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 17:59:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ETX16i3d; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CDD593B56B; Wed, 23 Feb 2022 17:28:04 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234855AbiBWUVy (ORCPT + 99 others); Wed, 23 Feb 2022 15:21:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232105AbiBWUVx (ORCPT ); Wed, 23 Feb 2022 15:21:53 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 010204D24F for ; Wed, 23 Feb 2022 12:21:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645647684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=u8kVwqcjIrD5zUdSjqNqhAiLPf0+xMjZB8/slyK3y54=; b=ETX16i3dcxlTZVtFX//qMwIybAtJN6xnsQMDSvYzlnmPVy/eHKCM+wrxln2wK6Kb3Feb+/ kDdzoETAKAN70zR5uwAD/57BC9O3cbHVSsN3ChDlS4emYQq0XA/bIEccFViCcy0ZEImYvK 6roOoqXtVQACr2m/AQKmgem2pjL7YS4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-632-G_v3OKqSOmiY5LGirGHCIg-1; Wed, 23 Feb 2022 15:21:22 -0500 X-MC-Unique: G_v3OKqSOmiY5LGirGHCIg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E4A8E1006AA5 for ; Wed, 23 Feb 2022 20:21:21 +0000 (UTC) Received: from madhat.home.dicksonnet.net (unknown [10.2.18.88]) by smtp.corp.redhat.com (Postfix) with ESMTP id 992DC61F20 for ; Wed, 23 Feb 2022 20:21:21 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH] systemd: Fix format-overflow warning Date: Wed, 23 Feb 2022 15:21:20 -0500 Message-Id: <20220223202120.126170-1-steved@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org rpc-pipefs-generator.c:35:23: error: '%s' directive output between 0 and 2147483653 bytes may exceed minimum required size of 4095 [-Werror=format-overflow=] 35 | sprintf(path, "%s/%s", dirname, pipefs_unit); | ^ Signed-off-by: Steve Dickson --- systemd/rpc-pipefs-generator.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/systemd/rpc-pipefs-generator.c b/systemd/rpc-pipefs-generator.c index c24db56..7b2bb4f 100644 --- a/systemd/rpc-pipefs-generator.c +++ b/systemd/rpc-pipefs-generator.c @@ -28,11 +28,12 @@ static int generate_mount_unit(const char *pipefs_path, const char *pipefs_unit, { char *path; FILE *f; + size_t size = (strlen(dirname) + 1 + strlen(pipefs_unit)); - path = malloc(strlen(dirname) + 1 + strlen(pipefs_unit)); + path = malloc(size); if (!path) return 1; - sprintf(path, "%s/%s", dirname, pipefs_unit); + snprintf(path, size, "%s/%s", dirname, pipefs_unit); f = fopen(path, "w"); if (!f) { -- 2.35.1