mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
fix possible pointer truncation on win64
This commit is contained in:
parent
afcce5ceca
commit
acbbe76d7b
1 changed files with 9 additions and 9 deletions
|
@ -4259,7 +4259,7 @@ PHP_FUNCTION(imap_mime_header_decode)
|
||||||
zval myobject;
|
zval myobject;
|
||||||
zend_string *str;
|
zend_string *str;
|
||||||
char *string, *charset, encoding, *text, *decode;
|
char *string, *charset, encoding, *text, *decode;
|
||||||
long charset_token, encoding_token, end_token, end, offset=0, i;
|
zend_long charset_token, encoding_token, end_token, end, offset=0, i;
|
||||||
unsigned long newlength;
|
unsigned long newlength;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
|
||||||
|
@ -4274,8 +4274,8 @@ PHP_FUNCTION(imap_mime_header_decode)
|
||||||
charset = (char *) safe_emalloc((end + 1), 2, 0);
|
charset = (char *) safe_emalloc((end + 1), 2, 0);
|
||||||
text = &charset[end + 1];
|
text = &charset[end + 1];
|
||||||
while (offset < end) { /* Reached end of the string? */
|
while (offset < end) { /* Reached end of the string? */
|
||||||
if ((charset_token = (long)php_memnstr(&string[offset], "=?", 2, string + end))) { /* Is there anything encoded in the string? */
|
if ((charset_token = (zend_long)php_memnstr(&string[offset], "=?", 2, string + end))) { /* Is there anything encoded in the string? */
|
||||||
charset_token -= (long)string;
|
charset_token -= (zend_long)string;
|
||||||
if (offset != charset_token) { /* Is there anything before the encoded data? */
|
if (offset != charset_token) { /* Is there anything before the encoded data? */
|
||||||
/* Retrieve unencoded data that is found before encoded data */
|
/* Retrieve unencoded data that is found before encoded data */
|
||||||
memcpy(text, &string[offset], charset_token-offset);
|
memcpy(text, &string[offset], charset_token-offset);
|
||||||
|
@ -4285,10 +4285,10 @@ PHP_FUNCTION(imap_mime_header_decode)
|
||||||
add_property_string(&myobject, "text", text);
|
add_property_string(&myobject, "text", text);
|
||||||
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &myobject);
|
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &myobject);
|
||||||
}
|
}
|
||||||
if ((encoding_token = (long)php_memnstr(&string[charset_token+2], "?", 1, string+end))) { /* Find token for encoding */
|
if ((encoding_token = (zend_long)php_memnstr(&string[charset_token+2], "?", 1, string+end))) { /* Find token for encoding */
|
||||||
encoding_token -= (long)string;
|
encoding_token -= (zend_long)string;
|
||||||
if ((end_token = (long)php_memnstr(&string[encoding_token+3], "?=", 2, string+end))) { /* Find token for end of encoded data */
|
if ((end_token = (zend_long)php_memnstr(&string[encoding_token+3], "?=", 2, string+end))) { /* Find token for end of encoded data */
|
||||||
end_token -= (long)string;
|
end_token -= (zend_long)string;
|
||||||
memcpy(charset, &string[charset_token + 2], encoding_token - (charset_token + 2)); /* Extract charset encoding */
|
memcpy(charset, &string[charset_token + 2], encoding_token - (charset_token + 2)); /* Extract charset encoding */
|
||||||
charset[encoding_token-(charset_token + 2)] = 0x00;
|
charset[encoding_token-(charset_token + 2)] = 0x00;
|
||||||
encoding=string[encoding_token + 1]; /* Extract encoding from string */
|
encoding=string[encoding_token + 1]; /* Extract encoding from string */
|
||||||
|
@ -4797,7 +4797,7 @@ PHP_FUNCTION(imap_timeout)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout = (long) mail_parameters(NIL, timeout_type, NIL);
|
timeout = (zend_long) mail_parameters(NIL, timeout_type, NIL);
|
||||||
RETURN_LONG(timeout);
|
RETURN_LONG(timeout);
|
||||||
} else if (timeout >= 0) {
|
} else if (timeout >= 0) {
|
||||||
switch (ttype) {
|
switch (ttype) {
|
||||||
|
@ -4818,7 +4818,7 @@ PHP_FUNCTION(imap_timeout)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout = (long) mail_parameters(NIL, timeout_type, (void *) timeout);
|
timeout = (zend_long) mail_parameters(NIL, timeout_type, (void *) timeout);
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
} else {
|
} else {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue