|
From: <ssm...@us...> - 2007-10-05 13:46:58
|
Revision: 2636
http://selinux.svn.sourceforge.net/selinux/?rev=2636&view=rev
Author: ssmalley
Date: 2007-10-05 06:46:54 -0700 (Fri, 05 Oct 2007)
Log Message:
-----------
Author: Ulrich Drepper
Email: dr...@re...
Subject: catch errors
Date: Tue, 28 Aug 2007 14:52:21 -0700
Given the buffer overflow which has been fixed recently I think it's
worthwhile adding to debug features. It's using the same technology as
glibc's _FORTIFY_SOURCE functionality. I would unconditionally define
DEBUG, in most cases the compiler can figure out there is no problem.
Modified Paths:
--------------
trunk/libsepol/src/private.h
Modified: trunk/libsepol/src/private.h
===================================================================
--- trunk/libsepol/src/private.h 2007-10-05 13:46:13 UTC (rev 2635)
+++ trunk/libsepol/src/private.h 2007-10-05 13:46:54 UTC (rev 2636)
@@ -45,3 +45,13 @@
extern int next_entry(void *buf, struct policy_file *fp, size_t bytes) hidden;
extern size_t put_entry(const void *ptr, size_t size, size_t n,
struct policy_file *fp) hidden;
+
+#ifdef DEBUG
+# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR >= 1)
+# define next_entry(buf, fp, bytes) \
+ ({ size_t _bytes = bytes; \
+ __builtin_object_size (buf, 0) != (size_t) -1 && sizeof (buf) < _bytes \
+ ? (abort (), -1) \
+ : next_entry (buf, fp, _bytes); })
+# endif
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|