summaryrefslogtreecommitdiff
path: root/ext/ftp/php_ftp.c
diff options
context:
space:
mode:
authorKalle Sommer Nielsen <kalle@php.net>2016-11-20 23:36:19 +0100
committerKalle Sommer Nielsen <kalle@php.net>2016-11-20 23:36:19 +0100
commit3ed0af3252dc85d4c4570d8fafd48147e6d44ab5 (patch)
tree5d58fe0b287a225fe32ec0914fdcfe4a1ec858d8 /ext/ftp/php_ftp.c
parentd711798813d6a1297716174de4382f42695a9e92 (diff)
downloadphp-git-3ed0af3252dc85d4c4570d8fafd48147e6d44ab5.tar.gz
Kill some more strlen() calls and fix a possible missing NULL pointer check
Thanks to Anatol for review
Diffstat (limited to 'ext/ftp/php_ftp.c')
-rw-r--r--ext/ftp/php_ftp.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c
index b0b4c4b780..914a8c7381 100644
--- a/ext/ftp/php_ftp.c
+++ b/ext/ftp/php_ftp.c
@@ -440,7 +440,7 @@ PHP_FUNCTION(ftp_login)
}
/* log in */
- if (!ftp_login(ftp, user, pass)) {
+ if (!ftp_login(ftp, user, user_len, pass, pass_len)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
RETURN_FALSE;
}
@@ -516,7 +516,7 @@ PHP_FUNCTION(ftp_chdir)
}
/* change directories */
- if (!ftp_chdir(ftp, dir)) {
+ if (!ftp_chdir(ftp, dir, dir_len)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
RETURN_FALSE;
}
@@ -543,7 +543,7 @@ PHP_FUNCTION(ftp_exec)
}
/* execute serverside command */
- if (!ftp_exec(ftp, cmd)) {
+ if (!ftp_exec(ftp, cmd, cmd_len)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
RETURN_FALSE;
}
@@ -570,7 +570,7 @@ PHP_FUNCTION(ftp_raw)
}
/* execute arbitrary ftp command */
- ftp_raw(ftp, cmd, return_value);
+ ftp_raw(ftp, cmd, cmd_len, return_value);
}
/* }}} */
@@ -620,7 +620,7 @@ PHP_FUNCTION(ftp_rmdir)
}
/* remove directorie */
- if (!ftp_rmdir(ftp, dir)) {
+ if (!ftp_rmdir(ftp, dir, dir_len)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
RETURN_FALSE;
}
@@ -705,7 +705,7 @@ PHP_FUNCTION(ftp_nlist)
}
/* get list of files */
- if (NULL == (nlist = ftp_nlist(ftp, dir))) {
+ if (NULL == (nlist = ftp_nlist(ftp, dir, dir_len))) {
RETURN_FALSE;
}
@@ -736,7 +736,7 @@ PHP_FUNCTION(ftp_rawlist)
}
/* get raw directory listing */
- if (NULL == (llist = ftp_list(ftp, dir, recursive))) {
+ if (NULL == (llist = ftp_list(ftp, dir, dir_len, recursive))) {
RETURN_FALSE;
}
@@ -810,7 +810,7 @@ PHP_FUNCTION(ftp_fget)
}
}
- if (!ftp_get(ftp, stream, file, xtype, resumepos)) {
+ if (!ftp_get(ftp, stream, file, file_len, xtype, resumepos)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
RETURN_FALSE;
}
@@ -860,7 +860,7 @@ PHP_FUNCTION(ftp_nb_fget)
ftp->direction = 0; /* recv */
ftp->closestream = 0; /* do not close */
- if ((ret = ftp_nb_get(ftp, stream, file, xtype, resumepos)) == PHP_FTP_FAILED) {
+ if ((ret = ftp_nb_get(ftp, stream, file, file_len, xtype, resumepos)) == PHP_FTP_FAILED) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
RETURN_LONG(ret);
}
@@ -946,7 +946,7 @@ PHP_FUNCTION(ftp_get)
RETURN_FALSE;
}
- if (!ftp_get(ftp, outstream, remote, xtype, resumepos)) {
+ if (!ftp_get(ftp, outstream, remote, remote_len, xtype, resumepos)) {
php_stream_close(outstream);
VCWD_UNLINK(local);
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
@@ -1014,7 +1014,7 @@ PHP_FUNCTION(ftp_nb_get)
ftp->direction = 0; /* recv */
ftp->closestream = 1; /* do close */
- if ((ret = ftp_nb_get(ftp, outstream, remote, xtype, resumepos)) == PHP_FTP_FAILED) {
+ if ((ret = ftp_nb_get(ftp, outstream, remote, remote_len, xtype, resumepos)) == PHP_FTP_FAILED) {
php_stream_close(outstream);
ftp->stream = NULL;
VCWD_UNLINK(local);
@@ -1101,7 +1101,7 @@ PHP_FUNCTION(ftp_fput)
if (ftp->autoseek && startpos) {
/* if autoresume is wanted ask for remote size */
if (startpos == PHP_FTP_AUTORESUME) {
- startpos = ftp_size(ftp, remote);
+ startpos = ftp_size(ftp, remote, remote_len);
if (startpos < 0) {
startpos = 0;
}
@@ -1111,7 +1111,7 @@ PHP_FUNCTION(ftp_fput)
}
}
- if (!ftp_put(ftp, remote, stream, xtype, startpos)) {
+ if (!ftp_put(ftp, remote, remote_len, stream, xtype, startpos)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
RETURN_FALSE;
}
@@ -1151,7 +1151,7 @@ PHP_FUNCTION(ftp_nb_fput)
if (ftp->autoseek && startpos) {
/* if autoresume is wanted ask for remote size */
if (startpos == PHP_FTP_AUTORESUME) {
- startpos = ftp_size(ftp, remote);
+ startpos = ftp_size(ftp, remote, remote_len);
if (startpos < 0) {
startpos = 0;
}
@@ -1165,7 +1165,7 @@ PHP_FUNCTION(ftp_nb_fput)
ftp->direction = 1; /* send */
ftp->closestream = 0; /* do not close */
- if (((ret = ftp_nb_put(ftp, remote, stream, xtype, startpos)) == PHP_FTP_FAILED)) {
+ if (((ret = ftp_nb_put(ftp, remote, remote_len, stream, xtype, startpos)) == PHP_FTP_FAILED)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
RETURN_LONG(ret);
}
@@ -1208,7 +1208,7 @@ PHP_FUNCTION(ftp_put)
if (ftp->autoseek && startpos) {
/* if autoresume is wanted ask for remote size */
if (startpos == PHP_FTP_AUTORESUME) {
- startpos = ftp_size(ftp, remote);
+ startpos = ftp_size(ftp, remote, remote_len);
if (startpos < 0) {
startpos = 0;
}
@@ -1218,7 +1218,7 @@ PHP_FUNCTION(ftp_put)
}
}
- if (!ftp_put(ftp, remote, instream, xtype, startpos)) {
+ if (!ftp_put(ftp, remote, remote_len, instream, xtype, startpos)) {
php_stream_close(instream);
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
RETURN_FALSE;
@@ -1263,7 +1263,7 @@ PHP_FUNCTION(ftp_nb_put)
if (ftp->autoseek && startpos) {
/* if autoresume is wanted ask for remote size */
if (startpos == PHP_FTP_AUTORESUME) {
- startpos = ftp_size(ftp, remote);
+ startpos = ftp_size(ftp, remote, remote_len);
if (startpos < 0) {
startpos = 0;
}
@@ -1277,7 +1277,7 @@ PHP_FUNCTION(ftp_nb_put)
ftp->direction = 1; /* send */
ftp->closestream = 1; /* do close */
- ret = ftp_nb_put(ftp, remote, instream, xtype, startpos);
+ ret = ftp_nb_put(ftp, remote, remote_len, instream, xtype, startpos);
if (ret != PHP_FTP_MOREDATA) {
php_stream_close(instream);
@@ -1310,7 +1310,7 @@ PHP_FUNCTION(ftp_size)
}
/* get file size */
- RETURN_LONG(ftp_size(ftp, file));
+ RETURN_LONG(ftp_size(ftp, file, file_len));
}
/* }}} */
@@ -1332,7 +1332,7 @@ PHP_FUNCTION(ftp_mdtm)
}
/* get file mod time */
- RETURN_LONG(ftp_mdtm(ftp, file));
+ RETURN_LONG(ftp_mdtm(ftp, file, file_len));
}
/* }}} */
@@ -1354,7 +1354,7 @@ PHP_FUNCTION(ftp_rename)
}
/* rename the file */
- if (!ftp_rename(ftp, src, dest)) {
+ if (!ftp_rename(ftp, src, src_len, dest, dest_len)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
RETURN_FALSE;
}
@@ -1381,7 +1381,7 @@ PHP_FUNCTION(ftp_delete)
}
/* delete the file */
- if (!ftp_delete(ftp, file)) {
+ if (!ftp_delete(ftp, file, file_len)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
RETURN_FALSE;
}
@@ -1408,7 +1408,7 @@ PHP_FUNCTION(ftp_site)
}
/* send the site command */
- if (!ftp_site(ftp, cmd)) {
+ if (!ftp_site(ftp, cmd, cmd_len)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
RETURN_FALSE;
}