[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ossec-dev] Re: [PATCH] use stack protector on never gcc versions that support it



Sorry, my host has had dns issues and doesn't seem to care about it
that my website is down even though they cash my check... I'll be
switching very soon.

It looks like they are back up, but the patch is attached just in case.

-- 

Jeff Schroeder

Don't drink and derive, alcohol and analysis don't mix.
Index: shared.h
===================================================================
RCS file: /usr/cvsroot/ossec-hids/src/headers/shared.h,v
retrieving revision 1.35
diff -u -r1.35 shared.h
--- shared.h	10 Aug 2007 00:56:22 -0000	1.35
+++ shared.h	16 Aug 2007 01:20:38 -0000
@@ -9,9 +9,25 @@
  * Foundation
  */
 
-/* v0.2 (2005/12/23): Adding 'u_int16_t' for Solaris.
+/* v0.3 (2007/12/23): Adding SSP & FORTIFY_SOURCE <jeffschroeder@xxxxxxxxxxxx>
+ * v0.2 (2005/12/23): Adding 'u_int16_t' for Solaris.
  * v0.1 (2005/10/27): first version.
  */
+
+/*
+ *  The stack smashing protector defeats some BoF via: gcc -fstack-protector
+ *  Reference: http://gcc.gnu.org/onlinedocs/gcc-4.1.2/cpp.pdf
+ */
+#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1) && (__GNUC_PATCHLEVEL__ >= 2)) || \
+                          ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || \
+                           (__GNUC__ >= 5))
+
+/* Heuristicly enable the stack protector on sensitive functions */
+#define __SSP__ 1
+
+/* FORTIFY_SOURCE is Redhat / Fedora specific */
+#define FORTIFY_SOURCE
+#endif
 
 #ifndef __SHARED_H
 

OSSEC home | Main Index | Thread Index


OSSEC project: www.ossec.net.
Mailling list information: http://www.ossec.net/en/mailing_lists.html.