!44 [sync] PR-38: quota: Use realloc(3) instead of reallocarray(3)

Merge pull request !44 from openeuler-sync-bot/sync-pr38-master-to-openEuler-24.03-LTS
This commit is contained in:
openeuler-ci-bot 2025-01-20 07:20:29 +00:00 committed by Gitee
commit 841525874e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From 02b222a335527f1031cc9495d8c5ebc1bc5b1d4e Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Wed, 11 Nov 2020 15:00:47 +0100
Subject: [PATCH] quota: Use realloc(3) instead of reallocarray(3)
reallocarray(3) has been added to glibc relatively recently (version
2.26, from 2017) and apparently not all users run new enough glibc. Just
use realloc(3) for now since in this case there's no real risk of
overflow.
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
quota.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/quota.c b/quota.c
index a6ed61f..a60de12 100644
--- a/quota.c
+++ b/quota.c
@@ -385,7 +385,7 @@ int main(int argc, char **argv)
break;
case 259:
fscount++;
- fsnames = reallocarray(fsnames, fscount, sizeof(char *));
+ fsnames = realloc(fsnames, fscount * sizeof(char *));
if (!fsnames)
die(1, _("Not enough memory for filesystem names"));
fsnames[fscount - 1] = optarg;
--
2.33.0

View File

@ -1,7 +1,7 @@
Name: quota
Version: 4.06
Epoch: 1
Release: 8
Release: 9
Summary: Linux Diskquota system as part of the Linux kernel
License: BSD and GPLv2 and GPLv2+ and LGPLv2+
URL: http://sourceforge.net/projects/linuxquota/
@ -19,6 +19,7 @@ Patch3: 0003-quota-Add-sw64-architecture.patch
Patch4: 0004-quota_nld-Initialize-sa_mask-when-registering-PID-fi.patch
Patch5: 0005-quota-nld-fix-open-PID-file-failed-when-systemd-read.patch
Patch6: 0006-common.c-fix-strncat-usage.patch
Patch7: 0007-quota-Use-realloc-3-instead-of-reallocarray-3.patch
BuildRequires: autoconf, automake, coreutils, rpcgen, systemd, gcc
BuildRequires: e2fsprogs-devel, gettext-devel, openldap-devel
@ -127,6 +128,9 @@ make check
%{_mandir}/man*/*
%changelog
* Mon Oct 14 2024 lvyy <lyunmail@163.com> - 1:4.06-9
- DESC:Use realloc(3) instead of reallocarray(3)
* Tue Jul 30 2024 wuguanghao <wuguanghao3@huawei.com> - 1:4.06-8
- common.c: fix strncat usage