summaryrefslogtreecommitdiff
path: root/extra/quota-tools/nulls.diff
blob: 97c5bc482263e57c1a8b2e5b6c37eda8692e914d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#Description: Avoid memory corruption of NULL address
#Author: Petr Pisar

--- quota/quotasys.c	2010-02-18 09:44:11.000000000 +0100
+++ quota-tools/quotasys.c	2010-05-05 08:02:53.000000000 +0200
@@ -746,9 +746,12 @@
 	kernel_qfmt_num = 0;
 	if (!stat("/proc/fs/xfs/stat", &st))
 		kernel_qfmt[kernel_qfmt_num++] = QF_XFS;
-	else
-		if (!quotactl(QCMD(Q_XGETQSTAT, 0), NULL, 0, NULL) || (errno != EINVAL && errno != ENOSYS))
+	else {
+		fs_quota_stat_t dummy;
+
+		if (!quotactl(QCMD(Q_XGETQSTAT, 0), "/dev/root", 0, (void *)&dummy) || (errno != EINVAL && errno != ENOSYS))
 			kernel_qfmt[kernel_qfmt_num++] = QF_XFS;
+	}
 	/* Detect new kernel interface; Assume generic interface unless we can prove there is not one... */
 	if (!stat("/proc/sys/fs/quota", &st) || errno != ENOENT) {
 		kernel_iface = IFACE_GENERIC;