From patchwork Wed Feb 28 13:58:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 13575546 X-Patchwork-Delegate: dsahern@gmail.com Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F85E14EFC1 for ; Wed, 28 Feb 2024 13:59:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709128762; cv=none; b=Z4bBOw0GGkrmuZJiQR45xj4wJGrX9OHGiOIeIovlDx0QwjhrYlAExgWnfjdn8+phfMgsimBJlSjqvJCaghNpj8V4HWvIlg3KakWOIUUYbwznkQ2aCB+PlQbXdXO9/wp7YLC7bBM4yoR85L1fPDsv4nsCGqRUG98FkoBOA0j9wFE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709128762; c=relaxed/simple; bh=4HgKVA1dS9r7ClZ7dFaEguke6UCIXLxQ8RYY5rEYbRE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=LiOnhD3LF6p3PKrL/Oeyev9NfyiyRsyWJmnO2aXZGJhnrhbPsgtR7MvkIx/6YE8Os5OoJrndOYhfG4Q8adRTGu8Ld8wRuaX/UuUeN3CDIRL0+FQK6C06oLbXHOV2Dc5DL1hLSS4W8+dw8WJ61inuYjiyEvCDanPSk+GDpTR+RSA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HmfmeTKF; arc=none smtp.client-ip=209.85.208.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HmfmeTKF" Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2d2c8c1b76cso2586471fa.1 for ; Wed, 28 Feb 2024 05:59:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709128759; x=1709733559; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2dNyu200RrJ1ULpYWG+XRBiEez1CyMQJAb/8qBEc3U4=; b=HmfmeTKFm1zE0PwBa8BD0TVx41l5gV5Ea89nN69Oa9rETD1f/e6YozO19qd5FfUBJo mRJCv1I+ygrrHiCQuDz3cgPWxanYrXv2oS/FE8SitXTtCVYR8wxhBDanKPyWq/L0Y1CZ a9iqIEhihczYvCSE6IA2/jERkmHAVtM9tBGi5DgE0MsEuPMIJK3/kSYN/yfk5gn9vnjy vQaq85iFjJQIZODLXe6WMMIq6mrUtdbRgy5IlejmVnL3wvi4NfPiQSi78vJioCercuKk 7WE3J5EdT0FlQmZUrvhil//bnuEscBFfLXSd5IHpPMnvCBTyLxWZX6d7GxJCrgwCtPfp RpSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709128759; x=1709733559; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2dNyu200RrJ1ULpYWG+XRBiEez1CyMQJAb/8qBEc3U4=; b=d3TOe9qqk8Qzy3vcUQ9XyUKyGBg21ZFPX8gpvCnFmZRv+4dDTw6MwyRaiSAmaFPrIs PhSLdoBXBFTLLF376W4V7AXeoJlmSXSr8QZ+n+4W1ffVhVizQfuK4boh64GoXeUvbAQZ jgdlMWaR+3cSerbPIE6W++br2rm+mzeUBRj7dS7IPpvRIqqEzx4lVdAjJ4DJ0+SYN7Ac sp2+kdQ2bqwKA3FmSCpUEqc9HuMrFctXdq+i6l+zQUPLmqDeWnV6mIbOwqnffOzoyqFT gOwjbWOd/XRu2/Ztyc3s+uc36Oo49fp7/c+QolIqaitGue54dRdyW+jl+NcCps6L8XNL B6aQ== X-Gm-Message-State: AOJu0Yxv5nTZI/LwRW5HgsLqdXiZSa8vTPrxuJjlcmOWoPRq05jlSuoQ z2629vmrkfqmdIZUJmz4eGTK/Te4MkVGASqUW82E36j+VQ0oGG+E X-Google-Smtp-Source: AGHT+IF8Mq3YwJysMrczLTXbuLexWx7rR74jeIUNHleOHFFAg4vda+1E3OulAD8wVZM+iy58e7HuHQ== X-Received: by 2002:a05:6512:3f20:b0:512:bd32:ed55 with SMTP id y32-20020a0565123f2000b00512bd32ed55mr9016252lfa.4.1709128758597; Wed, 28 Feb 2024 05:59:18 -0800 (PST) Received: from localhost.localdomain ([83.217.200.104]) by smtp.gmail.com with ESMTPSA id b19-20020a0565120b9300b005131e8b7103sm95204lfv.1.2024.02.28.05.59.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 05:59:17 -0800 (PST) From: Denis Kirjanov X-Google-Original-From: Denis Kirjanov To: stephen@networkplumber.org Cc: netdev@vger.kernel.org, Denis Kirjanov Subject: [PATCH iproute2 1/3] nstat: constify name argument in generic_proc_open Date: Wed, 28 Feb 2024 08:58:56 -0500 Message-Id: <20240228135858.3258-1-dkirjanov@suse.de> X-Mailer: git-send-email 2.30.2 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com the argument passed to the function is always a constant value Signed-off-by: Denis Kirjanov --- misc/nstat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/nstat.c b/misc/nstat.c index 2c10feaa..3a58885d 100644 --- a/misc/nstat.c +++ b/misc/nstat.c @@ -43,7 +43,7 @@ int npatterns; char info_source[128]; int source_mismatch; -static int generic_proc_open(const char *env, char *name) +static int generic_proc_open(const char *env, const char *name) { char store[128]; char *p = getenv(env); From patchwork Wed Feb 28 13:58:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 13575547 X-Patchwork-Delegate: dsahern@gmail.com Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D949414F9D5 for ; Wed, 28 Feb 2024 13:59:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709128764; cv=none; b=uElg/hpEHt3OsOsZLPOzxsC/luQtd2rAsbAIRsirqeQ8Dv3rzhLxEqveIgYDeZeA8PiDFlZK+1uwu+pbkhT4kvUrCXfr4RKtR1B2hC5gcO5lYqwMqrpWSSVMdLseZlts3nwrpFA+6o30yPX+C5g46JUdE6/VJwLmEPprqu26qBQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709128764; c=relaxed/simple; bh=sEX8rksW4kCJJt+qOL39gPQ/indXjd1rWJLQMlfDaRQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EterdL9AOhr4Qj5/9bT8g9byeQlFvKmSB7M+8ISgodcY3QDAiJg9Mhihl7jeFFdRGoxsHpF/IfrNba4sqOSgaZFxry44nfmB3QnDTWHCaTcUzcIVsbf9IlXmHOXvByLE5um2u1h74JNiC6AJ6ZqdfSm2FLpkhTniWiSV3nAaY2A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cngv/J/E; arc=none smtp.client-ip=209.85.208.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cngv/J/E" Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2d2c8c1b76cso2586621fa.1 for ; Wed, 28 Feb 2024 05:59:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709128761; x=1709733561; darn=vger.kernel.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=xrWCtetzfWjHWy26UrmGWzBFAhdo+uByz8UeFKzNpBo=; b=cngv/J/EsNhlmTDL03W7fdjP24Qa5uKsupw+E0ZqfxXuePNOz9mQCPL+sx7viEWA// Csdvs+Tas0Nc7ofUmzD4CecmFeiYNLAYjd6LBnuCZ+lfmR2cE82h5H4s7jPwDIogNUuQ OZE0o5iRE/8nxOa2AXvmTkstH4HY5MxMoNk3Le3XHM5/OrlQ2ce5Qq/FBRmaTZHzF9dv koeMTXN4xLJ0SYsyvYktFEVyx0+Es9czImjhHK460qZOT+jw4g3U6aYwt7VCCuHmTSrJ yLOhbz/x4dwOBdzeS3kF6kDawrmaBdit7gYI8aa6pYg5a4TO50WEdtK7Gz7cA9O+Ig2c CvnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709128761; x=1709733561; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xrWCtetzfWjHWy26UrmGWzBFAhdo+uByz8UeFKzNpBo=; b=qyffEiH6n3aIl2Cj3bzMLepltIKUM5tK/dyy8ex84vO4SCcZV4masOttKq5lLGzm6T QFwqcl6C1rGNQytnBYsgcoH8bC9Cf2SWzaD2ZBjnkMyVDpNWvPfo6kdjOD3vq31HszOC Ivz6oV1HVe6iZyybgm50m4aViwrqdwka8F/Uzn/WQh67uZcKqrqVZmIqTTlPRzWdaDsi XEqbpJLLy8WRZe9YZZGo857QcOk3C3x73B8pZFcj5046yI3eVYOu5xTp2eRbQoC0PfWW U4mPN3G0yD85+7MNFPNQutpYX+Z5svZE0e3YPhqP++/67ykCPwq/JBAD0vab6+nGaX7F /mYg== X-Gm-Message-State: AOJu0YxjxITV9jmBlz/77A2NldARZnPHeX9+RmcmIucy7VXG1T7V37oI cJHTeEWSyCoM2kPRJi2G0oBtm0ehtejeExuEPL2j2QqDDvMRm82naCW1DKGIzopZ18q8 X-Google-Smtp-Source: AGHT+IEp0x0cJ0oC/r9xq3GnMcbzWpj8RgzX7ZwIMiNuxSAuD7DXERELZGGOUj0MgCGrAR83t7fQPQ== X-Received: by 2002:a05:6512:3d88:b0:513:16a8:4292 with SMTP id k8-20020a0565123d8800b0051316a84292mr2452456lfv.2.1709128760853; Wed, 28 Feb 2024 05:59:20 -0800 (PST) Received: from localhost.localdomain ([83.217.200.104]) by smtp.gmail.com with ESMTPSA id b19-20020a0565120b9300b005131e8b7103sm95204lfv.1.2024.02.28.05.59.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 05:59:20 -0800 (PST) From: Denis Kirjanov X-Google-Original-From: Denis Kirjanov To: stephen@networkplumber.org Cc: netdev@vger.kernel.org, Denis Kirjanov Subject: [PATCH iproute2 2/3] nstat: use stack space for history file name Date: Wed, 28 Feb 2024 08:58:57 -0500 Message-Id: <20240228135858.3258-2-dkirjanov@suse.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240228135858.3258-1-dkirjanov@suse.de> References: <20240228135858.3258-1-dkirjanov@suse.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com as the name doesn't require a lot of storage put it on the stack. Moreover the memory allocated via malloc wasn't returned. Signed-off-by: Denis Kirjanov --- misc/nstat.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/misc/nstat.c b/misc/nstat.c index 3a58885d..ea96ccb0 100644 --- a/misc/nstat.c +++ b/misc/nstat.c @@ -580,7 +580,7 @@ static const struct option longopts[] = { int main(int argc, char *argv[]) { - char *hist_name; + char hist_name[128]; struct sockaddr_un sun; FILE *hist_fp = NULL; int ch; @@ -668,10 +668,11 @@ int main(int argc, char *argv[]) patterns = argv; npatterns = argc; - if ((hist_name = getenv("NSTAT_HISTORY")) == NULL) { - hist_name = malloc(128); - sprintf(hist_name, "/tmp/.nstat.u%d", getuid()); - } + if (getenv("NSTAT_HISTORY")) + snprintf(hist_name, sizeof(hist_name), + "%s", getenv("NSTAT_HISTORY")); + else + snprintf(hist_name, sizeof(hist_name), "/tmp/.nstat.u%d", getuid()); if (reset_history) unlink(hist_name); From patchwork Wed Feb 28 13:58:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 13575548 X-Patchwork-Delegate: dsahern@gmail.com Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40F3B151CDB for ; Wed, 28 Feb 2024 13:59:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709128766; cv=none; b=ZRCo9RCpEuAK47JU4EB7CI5z+NKeRD0SKYV1fOrHO9hW4ZH1kibfuMJczhBEIZz5ynpPnJivztCAp5+cqm1W6/Ii4LYyEYJ7t2DNuActIyY3TprMJdh8PmiFs+P1dn103sJ20e9ZzHHzYEXU9nJzul0AxTXKT2zNP61uzCnurfA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709128766; c=relaxed/simple; bh=38rh2rcGmYp3eG0FBJS3Tu+aaqrCsyjcVfRaI14cYfQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BiY0zpzI+BgRsa4Db6t7d2abWhRP6gGcQXO3K8y08aC99xu2LdXT2LvqSkT4GWqI5f8+ul2+r1rkj1iuL0D7fsGST66ex/cfHQzQ/B2VBYtaMqBqScH+pI/DX+5bYJ1m92z1Kh/WppwXwMZhKV1Yl7NgtBci+HOSP8jtClsUiKA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FlP4LZd1; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FlP4LZd1" Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-513056fe2b0so670179e87.0 for ; Wed, 28 Feb 2024 05:59:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709128763; x=1709733563; darn=vger.kernel.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=3MsZV9ZXZHa4eODBeyDTojMy/w9Lw+RzL4frXmBJ1Rc=; b=FlP4LZd1q6lcNdKTXUSprhm6cSfv7AbJHii6vxDJ4n1Aw+kVOMOoSs1Q546Dq6RFaT +vT0tl3aSHt/gckTZqcPxspcpH7pM3YGB9pedMISralgNfc4nD1fUyg6lKoIxnhFHfjt Fyprh/5nULLk7LKS1lLcXbYr1nlimIV+lPmfoyZcVOVefnOQxTUF2uaKbo5nRZFtUqnz DVM0a1X6LhdJXZXYMFtrJU2xtDzEDZk4+NhZY7g3028j1HhRIQZnmq6ubsoz7nnlrEGw jkc6x2kniKxLUBQOdpjgpK4XVs+xee9kxeYtcKBjJYl9Ofd/U/oPtQRphco3ts4vCUxF YMQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709128763; x=1709733563; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3MsZV9ZXZHa4eODBeyDTojMy/w9Lw+RzL4frXmBJ1Rc=; b=tpcze27GZvsAAj9si7sIsCgyA9hWaOeAJJ5b3RhU5Q6Abt0J4WcOAC7vhJEVdMyoOh wo+Nlh4l5P/j66HnZsYzJn99WUUB584dWj3JELUDGS1FcxkxYZRj2VKZNFKJxFTZhzCR FCqx2ygP7nWKpzw54Ow6cdpDjAcISSCdTEJBY+/7DW1+oIbnYvrQ65yN6nbbbdAa3Jh9 6kbskTS0ceX5OoVGsEEHp9BkuD7tP1iDd8z3qfAi3DX5mPQqUosIlANtbUySVXF7zCek 6uHa0LJSAMCySLKHSpVccnhwYZaTuSk/Sb5dZNXsF9O4XUqs8dz7RuYzuAVN8IMkCR7H 01eQ== X-Gm-Message-State: AOJu0YyiMUX1VSECuxtQeQt/H5fxfqi7WNwz4oB3ay+2StT/yejIshO3 rrCVTJek96IPChvLBg6tksdp4dFEp0G1AIlSwMCCPgXbrEGtazE4Q8QOoduJlIjebaFa X-Google-Smtp-Source: AGHT+IEBmxTo1lGFMMPRMYm+k1bloOutCpq3Ao1WOO2bwYVderXegg6Ry8KBfJsaPVQaurycZsZ8Ow== X-Received: by 2002:a05:6512:2820:b0:512:bc0e:27fe with SMTP id cf32-20020a056512282000b00512bc0e27femr7952528lfb.1.1709128763251; Wed, 28 Feb 2024 05:59:23 -0800 (PST) Received: from localhost.localdomain ([83.217.200.104]) by smtp.gmail.com with ESMTPSA id b19-20020a0565120b9300b005131e8b7103sm95204lfv.1.2024.02.28.05.59.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 05:59:22 -0800 (PST) From: Denis Kirjanov X-Google-Original-From: Denis Kirjanov To: stephen@networkplumber.org Cc: netdev@vger.kernel.org, Denis Kirjanov Subject: [PATCH iproute2 3/3] nstat: convert sprintf to snprintf Date: Wed, 28 Feb 2024 08:58:58 -0500 Message-Id: <20240228135858.3258-3-dkirjanov@suse.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240228135858.3258-1-dkirjanov@suse.de> References: <20240228135858.3258-1-dkirjanov@suse.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com Use snprintf to print only valid data. That's the similar change done for ifstat. Signed-off-by: Denis Kirjanov --- misc/nstat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/nstat.c b/misc/nstat.c index ea96ccb0..7beb620b 100644 --- a/misc/nstat.c +++ b/misc/nstat.c @@ -483,7 +483,7 @@ static void server_loop(int fd) p.fd = fd; p.events = p.revents = POLLIN; - sprintf(info_source, "%d.%lu sampling_interval=%d time_const=%d", + snprintf(info_source, sizeof(info_source), "%d.%lu sampling_interval=%d time_const=%d", getpid(), (unsigned long)random(), scan_interval/1000, time_constant/1000); load_netstat(); @@ -636,7 +636,7 @@ int main(int argc, char *argv[]) sun.sun_family = AF_UNIX; sun.sun_path[0] = 0; - sprintf(sun.sun_path+1, "nstat%d", getuid()); + snprintf(sun.sun_path + 1, sizeof(sun.sun_path) - 1, "nstat%d", getuid()); if (scan_interval > 0) { if (time_constant == 0)