Skip to content

Fix bugs reported in original project #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions lib4d_sql/base64.c
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| 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 |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Jim Winstead <[email protected]> |
+----------------------------------------------------------------------+
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| 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 |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Jim Winstead <[email protected]> |
+----------------------------------------------------------------------+
*/
/* $Id: base64.c,v 1.43.2.2.2.4 2007/12/31 07:20:12 sebastian Exp $ */

/* $Id: base64.c 287670 2009-08-25 08:35:39Z fourd $ */

#include <string.h>
#include <stdlib.h>
Expand Down Expand Up @@ -55,13 +56,13 @@ static const short base64_reverse_table[256] = {

/* {{{ php_base64_encode */
//PHPAPI
unsigned char *base64_encode(const unsigned char *str, int length, int *ret_length)
unsigned char *base64_encode(const char *str, size_t length, int *ret_length)
{
const unsigned char *current = str;
const char *current = str;
unsigned char *p;
unsigned char *result;

if ((length + 2) < 0 || ((length + 2) / 3) >= (1 << (sizeof(int) * 8 - 2))) {
if (((length + 2) / 3) >= (1 << (sizeof(int) * 8 - 2))) {
if (ret_length != NULL) {
*ret_length = 0;
}
Expand Down Expand Up @@ -137,17 +138,17 @@ void php_base64_init(void)
/* }}} */

//PHPAPI
unsigned char *base64_decode(const unsigned char *str, int length, int *ret_length)
unsigned char *base64_decode(const char *str, size_t length, int *ret_length)
{
return base64_decode_ex(str, length, ret_length, 0);
}

/* {{{ php_base64_decode */
/* as above, but backwards. :) */
//PHPAPI
unsigned char *base64_decode_ex(const unsigned char *str, int length, int *ret_length, int strict)
unsigned char *base64_decode_ex(const char *str, size_t length, int *ret_length, int strict)
{
const unsigned char *current = str;
const char *current = str;
int ch, i = 0, j = 0, k;
/* this sucks for threaded environments */
unsigned char *result;
Expand Down
8 changes: 4 additions & 4 deletions lib4d_sql/base64.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/

/* $Id: base64.h,v 1.14.2.1.2.3 2007/12/31 07:20:12 sebastian Exp $ */
/* $Id: base64.h 279540 2009-04-29 08:57:22Z splanquart $ */

#ifndef BASE64_H
#define BASE64_H
Expand All @@ -25,11 +25,11 @@
//PHP_FUNCTION(base64_encode);

//PHPAPI extern
unsigned char *base64_encode(const unsigned char *, int, int *);
unsigned char *base64_encode(const char *, size_t, int *);
//PHPAPI extern
unsigned char *base64_decode_ex(const unsigned char *, int, int *, int);
unsigned char *base64_decode_ex(const char *, size_t, int *, int);
//PHPAPI extern
unsigned char *base64_decode(const unsigned char *, int, int *);
unsigned char *base64_decode(const char *, size_t, int *);

#endif /* BASE64_H */

Expand Down
Loading