diff options
author | Sascha Schumann <sas@php.net> | 2000-09-27 16:08:26 +0000 |
---|---|---|
committer | Sascha Schumann <sas@php.net> | 2000-09-27 16:08:26 +0000 |
commit | 2e4ab6899588d586430d5e60606a24b31118dfc0 (patch) | |
tree | 534593f8bf6c6e1dd1aefd85c01aa2f5cda31e8b /ext/standard/file.c | |
parent | 3823ad3ec02a01e62da9e5bdf4a172d43f605b61 (diff) | |
download | php-git-2e4ab6899588d586430d5e60606a24b31118dfc0.tar.gz |
Automatic conversion might cause interpretation of 0xff as EOF, so we store
the result in an object of type int first.
Submitted by: melchers@cis.fu-berlin.de
Diffstat (limited to 'ext/standard/file.c')
-rw-r--r-- | ext/standard/file.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c index cd6a4ef638..9d810ca4dc 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -908,6 +908,7 @@ PHP_FUNCTION(fgetc) { int issock=0; int socketd=0; void *what; + int result; if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { WRONG_PARAM_COUNT; @@ -922,10 +923,11 @@ PHP_FUNCTION(fgetc) { } buf = emalloc(sizeof(int)); - if ((*buf = FP_FGETC(socketd, (FILE*)what, issock)) == EOF) { + if ((result = FP_FGETC(socketd, (FILE*)what, issock)) == EOF) { efree(buf); RETVAL_FALSE; } else { + buf[0]=result; buf[1]='\0'; return_value->value.str.val = buf; return_value->value.str.len = 1; |