Use realloc(3) instead of reallocarray(3)
(cherry picked from commit aef8e9b5b0b847698635485db426b3fccd11eb25)
This commit is contained in:
parent
e8fabf0738
commit
f1c2fe4abf
32
0007-quota-Use-realloc-3-instead-of-reallocarray-3.patch
Normal file
32
0007-quota-Use-realloc-3-instead-of-reallocarray-3.patch
Normal 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
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
Name: quota
|
Name: quota
|
||||||
Version: 4.06
|
Version: 4.06
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Release: 8
|
Release: 9
|
||||||
Summary: Linux Diskquota system as part of the Linux kernel
|
Summary: Linux Diskquota system as part of the Linux kernel
|
||||||
License: BSD and GPLv2 and GPLv2+ and LGPLv2+
|
License: BSD and GPLv2 and GPLv2+ and LGPLv2+
|
||||||
URL: http://sourceforge.net/projects/linuxquota/
|
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
|
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
|
Patch5: 0005-quota-nld-fix-open-PID-file-failed-when-systemd-read.patch
|
||||||
Patch6: 0006-common.c-fix-strncat-usage.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: autoconf, automake, coreutils, rpcgen, systemd, gcc
|
||||||
BuildRequires: e2fsprogs-devel, gettext-devel, openldap-devel
|
BuildRequires: e2fsprogs-devel, gettext-devel, openldap-devel
|
||||||
@ -127,6 +128,9 @@ make check
|
|||||||
%{_mandir}/man*/*
|
%{_mandir}/man*/*
|
||||||
|
|
||||||
%changelog
|
%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
|
* Tue Jul 30 2024 wuguanghao <wuguanghao3@huawei.com> - 1:4.06-8
|
||||||
- common.c: fix strncat usage
|
- common.c: fix strncat usage
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user