From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E82AA2BCF45 for ; Thu, 28 May 2026 19:19:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779995969; cv=none; b=JC7l6tXV1RoZEAr4pGff+lR68jTgf3pTSKZiLjU+IfPcm5Sql8Y1kjaWVm7q/eM7w7R/EXKE+vsfHQEEYxsLw8oXDcLEm8+7grzMlVKUyOwCM+Y1va/zBn8HjD0Ol7wcNdliM2XIfoLKFOa2LEIoYb0movOgGX7pQnrzD8F9his= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779995969; c=relaxed/simple; bh=19cP7/EmJS7NpJUIDWnC+O8se5hl0iSY+wc8Zv4w3kQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=UL4aU4BdaTB0K872O1mBBhucTui58umVrOisEzkgfwxJnVKl5yW/OMRic7YhIzpWb04+dQZ3kspcgghMLpQt09eXLFSJLnaSeNMdzbzuFETDUYUR7ick5//VPwOiENAFyQ+YDxHVsfCiAf9BFYRoJRLLLus5DKLseRqidqvniE0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=gQX81fnt; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gQX81fnt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779995966; 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=v7OtCuLllx7Qzqc3CX/Z+dGHfgIoMmAN1uq18AQKP0U=; b=gQX81fnt77j0IXMDlXg53v7X1jS6kOlsCsbR1PliD4D8BoFwTYS5zGxSA97/qr/LK98wz5 z4mUmUlYywqftx+FuXnlMAZfBIiuKyhBJgEiEK4iiI/RLnl6H8VFO6ffxRTJ+nxpFta807 4EpyHTeFTjYHZ7Snqz1KD/4kZwyne8g= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-618-dJGx4SISNBW9zz3Co9fM4g-1; Thu, 28 May 2026 15:19:25 -0400 X-MC-Unique: dJGx4SISNBW9zz3Co9fM4g-1 X-Mimecast-MFC-AGG-ID: dJGx4SISNBW9zz3Co9fM4g_1779995964 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7AB4619560A5 for ; Thu, 28 May 2026 19:19:24 +0000 (UTC) Received: from bighat.com (unknown [10.22.89.20]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 049D419560A3 for ; Thu, 28 May 2026 19:19:23 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH] Removed warnings in nfs_sockaddr2universal() Date: Thu, 28 May 2026 15:19:22 -0400 Message-ID: <20260528191922.67906-1-steved@redhat.com> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 in function 'nfs_sockaddr2universal', inlined from 'nsm_xmit_getaddr.constprop' at ../../support/nsm/rpc.c:251:17: ../../support/nfs/getport.c:459:24: warning: 'strndup' specified bound 108 exceeds source size 26 [-Wstringop-overread] 459 | return strndup(sun->sun_path, sizeof(sun->sun_path)); | ^ Signed-off-by: Steve Dickson --- This is a chatgpt solution to remove the warning... untested (yet) --- support/nfs/getport.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/support/nfs/getport.c b/support/nfs/getport.c index 813f7bf9..608e185b 100644 --- a/support/nfs/getport.c +++ b/support/nfs/getport.c @@ -452,11 +452,12 @@ char *nfs_sockaddr2universal(const struct sockaddr *sap) uint16_t port; size_t count; char *result; - int len; + int len = sizeof(struct sockaddr); switch (sap->sa_family) { case AF_LOCAL: - return strndup(sun->sun_path, sizeof(sun->sun_path)); + size_t path_len = len - offsetof(struct sockaddr_un, sun_path); + return strndup(sun->sun_path, path_len); case AF_INET: if (inet_ntop(AF_INET, (const void *)&sin->sin_addr.s_addr, buf, (socklen_t)sizeof(buf)) == NULL) -- 2.54.0