Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 1 | From 02b222a335527f1031cc9495d8c5ebc1bc5b1d4e Mon Sep 17 00:00:00 2001 |
| 2 | From: Fabrice Fontaine <fontaine.fabrice@gmail.com> |
| 3 | Date: Wed, 11 Nov 2020 15:00:47 +0100 |
| 4 | Subject: [PATCH] quota: Use realloc(3) instead of reallocarray(3) |
| 5 | |
| 6 | reallocarray(3) has been added to glibc relatively recently (version |
| 7 | 2.26, from 2017) and apparently not all users run new enough glibc. Just |
| 8 | use realloc(3) for now since in this case there's no real risk of |
| 9 | overflow. |
| 10 | |
| 11 | Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> |
| 12 | Signed-off-by: Jan Kara <jack@suse.cz> |
| 13 | Upstream-Status: Backport |
| 14 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> |
| 15 | --- |
| 16 | quota.c | 2 +- |
| 17 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 18 | |
| 19 | diff --git a/quota.c b/quota.c |
| 20 | index a6ed61f..a60de12 100644 |
| 21 | --- a/quota.c |
| 22 | +++ b/quota.c |
| 23 | @@ -385,7 +385,7 @@ int main(int argc, char **argv) |
| 24 | break; |
| 25 | case 259: |
| 26 | fscount++; |
| 27 | - fsnames = reallocarray(fsnames, fscount, sizeof(char *)); |
| 28 | + fsnames = realloc(fsnames, fscount * sizeof(char *)); |
| 29 | if (!fsnames) |
| 30 | die(1, _("Not enough memory for filesystem names")); |
| 31 | fsnames[fscount - 1] = optarg; |
| 32 | -- |
| 33 | 2.17.1 |
| 34 | |