1*4882a593SmuzhiyunFrom 02b222a335527f1031cc9495d8c5ebc1bc5b1d4e Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3*4882a593SmuzhiyunDate: Wed, 11 Nov 2020 15:00:47 +0100
4*4882a593SmuzhiyunSubject: [PATCH] quota: Use realloc(3) instead of reallocarray(3)
5*4882a593Smuzhiyun
6*4882a593Smuzhiyunreallocarray(3) has been added to glibc relatively recently (version
7*4882a593Smuzhiyun2.26, from 2017) and apparently not all users run new enough glibc. Just
8*4882a593Smuzhiyunuse realloc(3) for now since in this case there's no real risk of
9*4882a593Smuzhiyunoverflow.
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunSigned-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
12*4882a593SmuzhiyunSigned-off-by: Jan Kara <jack@suse.cz>
13*4882a593Smuzhiyun[Retrieved from:
14*4882a593Smuzhiyunhttps://sourceforge.net/p/linuxquota/code/ci/02b222a335527f1031cc9495d8c5ebc1bc5b1d4e]
15*4882a593Smuzhiyun---
16*4882a593Smuzhiyun quota.c | 2 +-
17*4882a593Smuzhiyun 1 file changed, 1 insertion(+), 1 deletion(-)
18*4882a593Smuzhiyun
19*4882a593Smuzhiyundiff --git a/quota.c b/quota.c
20*4882a593Smuzhiyunindex a6ed61f..a60de12 100644
21*4882a593Smuzhiyun--- a/quota.c
22*4882a593Smuzhiyun+++ b/quota.c
23*4882a593Smuzhiyun@@ -385,7 +385,7 @@ int main(int argc, char **argv)
24*4882a593Smuzhiyun 			  break;
25*4882a593Smuzhiyun 		  case 259:
26*4882a593Smuzhiyun 			  fscount++;
27*4882a593Smuzhiyun-			  fsnames = reallocarray(fsnames, fscount, sizeof(char *));
28*4882a593Smuzhiyun+			  fsnames = realloc(fsnames, fscount * sizeof(char *));
29*4882a593Smuzhiyun 			  if (!fsnames)
30*4882a593Smuzhiyun 				die(1, _("Not enough memory for filesystem names"));
31*4882a593Smuzhiyun 			  fsnames[fscount - 1] = optarg;
32*4882a593Smuzhiyun--
33*4882a593Smuzhiyun2.28.0
34*4882a593Smuzhiyun
35