From 940aecfcffe12b565ff0e06d1b6c838a86dfbdd0 Mon Sep 17 00:00:00 2001 From: jkar8572 Date: Tue, 4 May 2010 12:37:39 +0000 Subject: [PATCH] * avoid memory corruption of NULL address (Petr Pisar) Petr Pisar: Upstream patch without Changelog lines. diff --git a/quotasys.c b/quotasys.c index 8df5e3b..cce5787 100644 --- a/quotasys.c +++ b/quotasys.c @@ -746,9 +746,12 @@ void init_kernel_interface(void) 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), NULL, 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; -- 1.7.3.2