4b424eb
Avoid memory corruption of NULL address.
4b424eb
4b424eb
Backport of
4b424eb
<https://sourceforge.net/tracker/?func=detail&aid=2996418&group_id=18136&atid=118136>
4b424eb
and n+2nd CVS commit.
4b424eb
4b424eb
diff --git a/quotasys.c b/quotasys.c
4b424eb
index 9a7f440..0a4a609 100644
4b424eb
--- a/quotasys.c
4b424eb
+++ b/quotasys.c
4b424eb
@@ -707,9 +707,12 @@ void init_kernel_interface(void)
4b424eb
 	kernel_formats = 0;
4b424eb
 	if (!stat("/proc/fs/xfs/stat", &st))
4b424eb
 		kernel_formats |= (1 << QF_XFS);
4b424eb
-	else
4b424eb
-		if (!quotactl(QCMD(Q_XGETQSTAT, 0), NULL, 0, NULL) || (errno != EINVAL && errno != ENOSYS))
4b424eb
+	else {
4b424eb
+		fs_quota_stat_t dummy;
4b424eb
+
4b424eb
+		if (!quotactl(QCMD(Q_XGETQSTAT, 0), "/dev/root", 0, (void *)&dummy) || (errno != EINVAL && errno != ENOSYS))
4b424eb
 			kernel_formats |= (1 << QF_XFS);
4b424eb
+	}
4b424eb
 	/* Detect new kernel interface; Assume generic interface unless we can prove there is not one... */
4b424eb
 	if (!stat("/proc/sys/fs/quota", &st) || errno != ENOENT) {
4b424eb
 		kernel_iface = IFACE_GENERIC;