summaryrefslogtreecommitdiff
path: root/libio
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-03-03 16:52:27 +0000
committerJakub Jelinek <jakub@redhat.com>2005-03-03 16:52:27 +0000
commit1f53f6f82f2165e421d94a83a731c1308097849f (patch)
treec264f23f46c0f440348f75093e59cacfc9c60dba /libio
parenta3f1b27bd61b4bd1645e90953eb09ae2aa3ef9e9 (diff)
2.3.4-11
Diffstat (limited to 'libio')
-rw-r--r--libio/bits/stdio2.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index e33cbb401a..6ab6841c53 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -88,13 +88,17 @@ extern char *__gets_chk (char *__str, size_t);
((__bos (__str) == (size_t) -1) \
? gets (__str) : __gets_chk (__str, __bos (__str)))
-extern char *__fgets_chk (char *s, size_t size, int n, FILE *stream);
+extern void __chk_fail (void) __attribute__((noreturn));
#define fgets(__str, __n, __fp) \
- ((__bos (__str) == (size_t) -1) \
- ? fgets (__str, __n, __fp) : __fgets_chk (__str, __bos (__str), __n, __fp))
+ (__extension__ \
+ ({ size_t __n_val = (__n); \
+ if (__bos (__str) != (size_t) -1 && __bos (__str) < __n_val) \
+ __chk_fail (); \
+ fgets (__str, __n_val, __fp); }))
-extern char *__fgets_unlocked_chk (char *s, size_t size, int n, FILE *stream);
#define fgets_unlocked(__str, __n, __fp) \
- ((__bos (__str) == (size_t) -1) \
- ? fgets_unlocked (__str, __n, __fp) \
- : __fgets_unlocked_chk (__str, __bos (__str), __n, __fp))
+ (__extension__ \
+ ({ size_t __n_val = (__n); \
+ if (__bos (__str) != (size_t) -1 && __bos (__str) < __n_val) \
+ __chk_fail (); \
+ fgets_unlocked (__str, __n_val, __fp); }))