Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159995347
D56734.id176852.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D56734.id176852.diff
View Options
diff --git a/include/ssp/stdio.h b/include/ssp/stdio.h
--- a/include/ssp/stdio.h
+++ b/include/ssp/stdio.h
@@ -36,6 +36,10 @@
#include <ssp/ssp.h>
+#if __SSP_FORTIFY_LEVEL > 0 && __EXT1_VISIBLE
+#include <sys/stdint.h>
+#endif
+
__BEGIN_DECLS
#if __SSP_FORTIFY_LEVEL > 0
#if __POSIX_VISIBLE
@@ -51,7 +55,23 @@
__ssp_redirect(size_t, fread_unlocked, (void *__restrict __buf, size_t __len,
size_t __nmemb, FILE *__restrict __fp), (__buf, __len, __nmemb, __fp));
#if __EXT1_VISIBLE
-__ssp_redirect(char *, gets_s, (char *__buf, rsize_t __len), (__buf, __len));
+__ssp_redirect_raw_impl(char *, gets_s, gets_s,
+ (char *buf, rsize_t len))
+{
+ size_t bufsz;
+
+ /*
+ * If we would have overwritten our buffer, we want to fail the check
+ * only if these arguments wouldn't have triggered a constraint
+ * violation.
+ */
+ bufsz = __ssp_bos(buf);
+ if (bufsz != (size_t)-1 && (size_t)len > bufsz && len <= RSIZE_MAX)
+ __chk_fail();
+
+ return (__ssp_real(gets_s)(buf, len));
+}
+
#endif /* __EXT1_VISIBLE */
__ssp_redirect_raw(char *, tmpnam, tmpnam, (char *__buf), (__buf), 1,
__ssp_bos, L_tmpnam);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jun 21, 8:54 AM (12 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32554919
Default Alt Text
D56734.id176852.diff (1 KB)
Attached To
Mode
D56734: ssp: fix our gets_s implementation under _FORTIFY_SOURCE
Attached
Detach File
Event Timeline
Log In to Comment