Module Name:    src
Committed By:   christos
Date:           Wed Nov 15 03:15:28 UTC 2023

Modified Files:
        src/lib/libc/ssp: Makefile.inc
Added Files:
        src/lib/libc/ssp: ssp_redirect.c

Log Message:
provide materialized functions for the ssp overriden inlines


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/ssp/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/libc/ssp/ssp_redirect.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/ssp/Makefile.inc
diff -u src/lib/libc/ssp/Makefile.inc:1.5 src/lib/libc/ssp/Makefile.inc:1.6
--- src/lib/libc/ssp/Makefile.inc:1.5	Sun Apr  6 15:29:37 2014
+++ src/lib/libc/ssp/Makefile.inc	Tue Nov 14 22:15:28 2023
@@ -1,11 +1,11 @@
-#	$NetBSD: Makefile.inc,v 1.5 2014/04/06 19:29:37 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.6 2023/11/15 03:15:28 christos Exp $
 
 .PATH: ${.CURDIR}/ssp
 
 SSP_SRCS=	gets_chk.c fgets_chk.c memcpy_chk.c memmove_chk.c memset_chk.c \
 		snprintf_chk.c sprintf_chk.c stpcpy_chk.c stpncpy_chk.c \
 		strcat_chk.c strcpy_chk.c strncat_chk.c strncpy_chk.c \
-		vsnprintf_chk.c vsprintf_chk.c
+		vsnprintf_chk.c vsprintf_chk.c ssp_redirect.c
 
 .for i in ${SSP_SRCS}
 SRCS+=${i}

Added files:

Index: src/lib/libc/ssp/ssp_redirect.c
diff -u /dev/null src/lib/libc/ssp/ssp_redirect.c:1.1
--- /dev/null	Tue Nov 14 22:15:28 2023
+++ src/lib/libc/ssp/ssp_redirect.c	Tue Nov 14 22:15:28 2023
@@ -0,0 +1,56 @@
+/*	$NetBSD: ssp_redirect.c,v 1.1 2023/11/15 03:15:28 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2023 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#undef _FORTIFY_SOURCE
+#define _FORTIFY_SOURCE 2
+#define __ssp_inline
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: ssp_redirect.c,v 1.1 2023/11/15 03:15:28 christos Exp $");
+
+#include <unistd.h>
+
+int ssp_use(void);
+
+/*
+ * Provide definitions of the redirect functions in libc.
+ */
+int
+ssp_use(void)
+{
+	if (getcwd(NULL, 0) == NULL)
+		return -1;
+	if (read(-1, NULL, 0) == -1)
+		return -1;
+	if (readlink(NULL, NULL, 0) == -1)
+		return -1;
+	return 0;
+}

Reply via email to