summaryrefslogtreecommitdiff
path: root/StdLib/LibC/Stdio/ungetc.c
diff options
context:
space:
mode:
Diffstat (limited to 'StdLib/LibC/Stdio/ungetc.c')
-rw-r--r--StdLib/LibC/Stdio/ungetc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/StdLib/LibC/Stdio/ungetc.c b/StdLib/LibC/Stdio/ungetc.c
index e9d3807fcb..d8e1f3afc6 100644
--- a/StdLib/LibC/Stdio/ungetc.c
+++ b/StdLib/LibC/Stdio/ungetc.c
@@ -1,11 +1,11 @@
/** @file
Implementation of ungetc as declared in <stdio.h>.
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License that accompanies this
distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
+ http://opensource.org/licenses/bsd-license.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@@ -67,6 +67,10 @@ __submore(FILE *fp)
unsigned char *p;
_DIAGASSERT(fp != NULL);
+ if(fp == NULL) {
+ errno = EINVAL;
+ return (EOF);
+ }
if (_UB(fp)._base == fp->_ubuf) {
/*
@@ -98,6 +102,10 @@ int
ungetc(int c, FILE *fp)
{
_DIAGASSERT(fp != NULL);
+ if(fp == NULL) {
+ errno = EINVAL;
+ return (EOF);
+ }
if (c == EOF)
return (EOF);