From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DDBED48C54; Sun, 7 Dec 2025 20:14:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0BA5B406BB; Sun, 7 Dec 2025 20:13:17 +0100 (CET) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mails.dpdk.org (Postfix) with ESMTP id 037914069F for ; Sun, 7 Dec 2025 20:13:15 +0100 (CET) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-47778b23f64so23064055e9.0 for ; Sun, 07 Dec 2025 11:13:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1765134794; x=1765739594; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1UoBNUoi1+EhVE1t3Dqovg1x7UhVI8Us1tilpBbA6+I=; b=2RNK3cLRFu8ZnraahcFH0oFHSHAvmVxcB36HJREJjamnr4OnYoeUGNDIiH2hIgoWCZ /bvpEV5N96KtDD6BvmI5mV5ovwvMobjUackqn6E3xPk1qWbHwXv1hLEbHBh7c/GE439J L/nTNHIJcAXTqyLoDilx1ruukXK+rmWglzfCbRYxjcV3AT8bG2J/5AeJOH0ftZDGws/I YiwshT3VwBmfqHAVAgN4UM9zvMU6OlfLOXpGi/WOgDTUGHvrYpR7JHr0a1Z1JwbhIWZr qfzGoU7VOb5yXdwgrNxRyCs54j3mtPPo9wcFW8dNTs+hQ/cyVG28AbXDMEnBAMkKiN53 V33g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765134794; x=1765739594; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject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3deP6YufT+RcuqHprLmdeRMlGkoBswTNnQ== X-Google-Smtp-Source: AGHT+IHVnAOsQycE+WHwdXBfeEsTlg4fcKsEfQYpuXH1kVvISPEqoX4XaPstEz1ytFxdWOoLiKppnw== X-Received: by 2002:a05:600c:3b07:b0:477:1ae1:fa5d with SMTP id 5b1f17b1804b1-47939e27b85mr55622105e9.20.1765134794602; Sun, 07 Dec 2025 11:13:14 -0800 (PST) Received: from phoenix.lan (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-479310b8e70sm205124205e9.5.2025.12.07.11.13.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Dec 2025 11:13:14 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v5 14/17] eal: handle long shared library path Date: Sun, 7 Dec 2025 11:12:05 -0800 Message-ID: <20251207191242.165619-15-stephen@networkplumber.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251207191242.165619-1-stephen@networkplumber.org> References: <20251205022948.327743-1-stephen@networkplumber.org> <20251207191242.165619-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Instead of a fixed size shared library path that could in theory get truncated when concatenating, use a dynamically allocated buffer via asprintf. Signed-off-by: Stephen Hemminger --- lib/eal/common/eal_common_options.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index b1fb670ea0..6aa078e135 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -570,7 +570,6 @@ static int eal_plugindir_init(const char *path) { struct dirent *dent = NULL; - char sopath[PATH_MAX]; DIR *d = NULL; if (path == NULL || *path == '\0') @@ -584,19 +583,29 @@ eal_plugindir_init(const char *path) } while ((dent = readdir(d)) != NULL) { + char *sopath = NULL; struct stat sb; if (!ends_with(dent->d_name, ".so") && !ends_with(dent->d_name, ".so."ABI_VERSION)) continue; - snprintf(sopath, sizeof(sopath), "%s/%s", path, dent->d_name); + if (asprintf(&sopath, "%s/%s", path, dent->d_name) < 0) { + EAL_LOG(ERR, "failed to create full path %s/%s", + path, dent->d_name); + continue; + } /* if a regular file, add to list to load */ - if (!(stat(sopath, &sb) == 0 && S_ISREG(sb.st_mode))) + if (!(stat(sopath, &sb) == 0 && S_ISREG(sb.st_mode))) { + free(sopath); continue; + } - if (eal_plugin_add(sopath) == -1) + if (eal_plugin_add(sopath) == -1) { + free(sopath); break; + } + free(sopath); } closedir(d); -- 2.51.0