Skip to contentSkip to conversation

Ensure consistent struct stat definition

PATCH In review Doug Nazar 2 participants 2 messages Oct 31, 2019 – Nov 17, 2019

Subsystems (2)
lore
Share & tools
lore

Doug Nazar

author
#0 lore raw

PATCH 1/1 Ensure consistent struct stat definition

Although 2fbc62e2a13fc ("Fix include order between config.h and stat.h") reorganized those files that were already including config.h, not all files were including config.h.

Fixes at least stack smashing crashes in mountd on 32-bit systems.

---
 support/junction/junction.c | 4 ++++
 support/misc/file.c         | 4 ++++
 support/misc/mountpoint.c   | 4 ++++
 support/nfs/cacheio.c       | 4 ++++
 utils/mount/fstab.c         | 4 ++++
 utils/nfsdcld/legacy.c      | 4 ++++
 6 files changed, 24 insertions(+)
support/junction/junction.c +4 -0
index ab6caa61..41cce261 100644
@@ -23,6 +23,10 @@
  *	http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <sys/types.h>
 #include <sys/stat.h>
 
support/misc/file.c +4 -0
index e7c38190..06f6bb2b 100644
@@ -18,6 +18,10 @@
  * along with nfs-utils.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <sys/stat.h>
 
 #include <string.h>
support/misc/mountpoint.c +4 -0
index c6217f24..14d6731d 100644
@@ -3,6 +3,10 @@
  * check if a given path is a mountpoint 
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <string.h>
 #include "xcommon.h"
 #include <sys/stat.h>
support/nfs/cacheio.c +4 -0
index 9dc4cf1c..7c4cf373 100644
@@ -15,6 +15,10 @@
  *
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <nfslib.h>
 #include <stdio.h>
 #include <stdio_ext.h>
utils/mount/fstab.c +4 -0
index eedbddab..8b0aaf1a 100644
@@ -7,6 +7,10 @@
  * - Moved code to nfs-utils/support/nfs from util-linux/mount.
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <errno.h>
 #include <stdio.h>
 #include <fcntl.h>
utils/nfsdcld/legacy.c +4 -0
index 07f477ab..3c6bea6c 100644
@@ -15,6 +15,10 @@
  * Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <dirent.h>
 #include <string.h>
Signature · 1 line
2.23.0
#1 lore raw
Quoted 7 lines · Doug Nazar

Although 2fbc62e2a13fc ("Fix include order between config.h and stat.h") reorganized those files that were already including config.h, not all files were including config.h.

Fixes at least stack smashing crashes in mountd on 32-bit systems.

Quoted 8 lines
---
 support/junction/junction.c | 4 ++++
 support/misc/file.c         | 4 ++++
 support/misc/mountpoint.c   | 4 ++++
 support/nfs/cacheio.c       | 4 ++++
 utils/mount/fstab.c         | 4 ++++
 utils/nfsdcld/legacy.c      | 4 ++++
 6 files changed, 24 insertions(+)

Committed!

steved.

Quoted 92 lines
support/junction/junction.c +4 -0
index ab6caa61..41cce261 100644
@@ -23,6 +23,10 @@
  *	http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <sys/types.h>
 #include <sys/stat.h>
 
support/misc/file.c +4 -0
index e7c38190..06f6bb2b 100644
@@ -18,6 +18,10 @@
  * along with nfs-utils.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <sys/stat.h>
 
 #include <string.h>
support/misc/mountpoint.c +4 -0
index c6217f24..14d6731d 100644
@@ -3,6 +3,10 @@
  * check if a given path is a mountpoint 
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <string.h>
 #include "xcommon.h"
 #include <sys/stat.h>
support/nfs/cacheio.c +4 -0
index 9dc4cf1c..7c4cf373 100644
@@ -15,6 +15,10 @@
  *
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <nfslib.h>
 #include <stdio.h>
 #include <stdio_ext.h>
utils/mount/fstab.c +4 -0
index eedbddab..8b0aaf1a 100644
@@ -7,6 +7,10 @@
  * - Moved code to nfs-utils/support/nfs from util-linux/mount.
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <errno.h>
 #include <stdio.h>
 #include <fcntl.h>
utils/nfsdcld/legacy.c +4 -0
index 07f477ab..3c6bea6c 100644
@@ -15,6 +15,10 @@
  * Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <dirent.h>
 #include <string.h>