|
|
| version 1.1, 2012/02/21 23:48:02 | version 1.1.1.4, 2014/06/15 20:03:57 |
|---|---|
| Line 2 | Line 2 |
| +----------------------------------------------------------------------+ | +----------------------------------------------------------------------+ |
| | PHP Version 5 | | | PHP Version 5 | |
| +----------------------------------------------------------------------+ | +----------------------------------------------------------------------+ |
| | Copyright (c) 1997-2012 The PHP Group | | | Copyright (c) 1997-2014 The PHP Group | |
| +----------------------------------------------------------------------+ | +----------------------------------------------------------------------+ |
| | This source file is subject to version 3.01 of the PHP license, | | | This source file is subject to version 3.01 of the PHP license, | |
| | that is bundled with this package in the file LICENSE, and is | | | that is bundled with this package in the file LICENSE, and is | |
| Line 59 PHPAPI unsigned char *php_base64_encode(const unsigned | Line 59 PHPAPI unsigned char *php_base64_encode(const unsigned |
| unsigned char *p; | unsigned char *p; |
| unsigned char *result; | unsigned char *result; |
| if ((length + 2) < 0 || ((length + 2) / 3) >= (1 << (sizeof(int) * 8 - 2))) { | if (length < 0) { |
| if (ret_length != NULL) { | if (ret_length != NULL) { |
| *ret_length = 0; | *ret_length = 0; |
| } | } |
| return NULL; | return NULL; |
| } | } |
| result = (unsigned char *)safe_emalloc(((length + 2) / 3) * 4, sizeof(char), 1); | result = (unsigned char *) safe_emalloc((length + 2) / 3, 4 * sizeof(char), 1); |
| p = result; | p = result; |
| while (length > 2) { /* keep going until we have less than 24 bits */ | while (length > 2) { /* keep going until we have less than 24 bits */ |