Skip to content

Conversation

@ndossche
Copy link
Member

No description provided.

zend_string *table_name;
zend_string *pg_delimiter = NULL;
char *pg_null_as = NULL;
char *pg_null_as = "\\\\N";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you mark this as const 🤔

Suggested change
char *pg_null_as = "\\\\N";
const char *pg_null_as = "\\\\N";

Also, isn't there potentially an issue if the user defined value contains a nul byte?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you mark this as const 🤔

No, because the Z_PARAM_STRING API internally calls the zend_parse_arg_string helper that has char **dest.

Also, isn't there potentially an issue if the user defined value contains a nul byte?

Yes

@devnexen
Copy link
Member

looks good, no idea if you want to try gina's suggestion or leave it for another PR eventually.

@ndossche
Copy link
Member Author

looks good, no idea if you want to try gina's suggestion or leave it for another PR eventually.

I'll leave it. The const thing requires zend api changes. The NUL issue should be fixed separately and we should do an audit of the entire extension and fix all such issues in one go

@devnexen
Copy link
Member

looks good, no idea if you want to try gina's suggestion or leave it for another PR eventually.

I'll leave it. The const thing requires zend api changes. The NUL issue should be fixed separately and we should do an audit of the entire extension and fix all such issues in one go

sure I was only referring to the param change to path type. Fine then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants