Page MenuHomeFreeBSD

D12295.diff
No OneTemporary

D12295.diff

Index: lib/libc/stdio/gets.c
===================================================================
--- lib/libc/stdio/gets.c
+++ lib/libc/stdio/gets.c
@@ -44,36 +44,11 @@
#include "libc_private.h"
#include "local.h"
-__warn_references(gets, "warning: this program uses gets(), which is unsafe.");
+__warn_references(gets, "warning: this program uses gets(), which is unsafe and has been disabled.");
char *
gets(char *buf)
{
- int c;
- char *s, *ret;
- static int warned;
- static const char w[] =
- "warning: this program uses gets(), which is unsafe.\n";
- FLOCKFILE_CANCELSAFE(stdin);
- ORIENT(stdin, -1);
- if (!warned) {
- (void) _write(STDERR_FILENO, w, sizeof(w) - 1);
- warned = 1;
- }
- for (s = buf; (c = __sgetc(stdin)) != '\n'; ) {
- if (c == EOF)
- if (s == buf) {
- ret = NULL;
- goto end;
- } else
- break;
- else
- *s++ = c;
- }
- *s = 0;
- ret = buf;
-end:
- FUNLOCKFILE_CANCELSAFE();
- return (ret);
+ abort();
}

File Metadata

Mime Type
text/plain
Expires
Sun, May 24, 10:21 PM (11 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33488892
Default Alt Text
D12295.diff (964 B)

Event Timeline