Skip to content

Commit

Permalink
use 'p' to protect from nul in filename
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet committed Jan 25, 2024
1 parent cfbf0a2 commit 06a9582
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dio.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ PHP_FUNCTION(dio_open)
zend_long mode = 0;
int fd;

if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l", &file_name, &file_name_length, &flags, &mode) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "pl|l", &file_name, &file_name_length, &flags, &mode) == FAILURE) {
RETURN_THROWS();
}

Expand Down
4 changes: 2 additions & 2 deletions src/dio_stream_wrappers.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ PHP_FUNCTION(dio_raw) {
char *mode;
size_t mode_len;

if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|h!", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ps|h!", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) {
RETURN_THROWS();
}

Expand Down Expand Up @@ -353,7 +353,7 @@ PHP_FUNCTION(dio_serial) {
char *mode;
size_t mode_len;

if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|h!", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ps|h!", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) {
RETURN_THROWS();
}

Expand Down

0 comments on commit 06a9582

Please sign in to comment.