From: Ulrich Drepper <drepper@redhat.com>
To: SE-Linux <selinux@tycho.nsa.gov>
Subject: catch errors
Date: Tue, 28 Aug 2007 14:52:21 -0700 [thread overview]
Message-ID: <46D49915.9020403@redhat.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 375 bytes --]
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.
--
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
[-- Attachment #1.2: d-libsepol-chk --]
[-- Type: text/plain, Size: 771 bytes --]
diff -durp libsepol-2.0.7/src/private.h libsepol-2.0.7-chk/src/private.h
--- libsepol-2.0.7/src/private.h 2007-08-28 14:43:36.000000000 -0700
+++ libsepol-2.0.7-chk/src/private.h 2007-08-28 14:47:26.000000000 -0700
@@ -45,3 +45,13 @@ extern struct policydb_compat_info *poli
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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
reply other threads:[~2007-08-29 16:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46D49915.9020403@redhat.com \
--to=drepper@redhat.com \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.