Blob Blame Raw
Avoid memory corruption of NULL address.

Backport of
<https://sourceforge.net/tracker/?func=detail&aid=2996418&group_id=18136&atid=118136>
and n+2nd CVS commit.

diff --git a/quotasys.c b/quotasys.c
index 9a7f440..0a4a609 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -707,9 +707,12 @@ void init_kernel_interface(void)
 	kernel_formats = 0;
 	if (!stat("/proc/fs/xfs/stat", &st))
 		kernel_formats |= (1 << 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_formats |= (1 << 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;