Skip to content

lib, src, tests: added space around ternary expressions - #14912

Closed
mihaigmarin wants to merge 1 commit into
curl:masterfrom
mihaigmarin:feature/tidy-ups
Closed

lib, src, tests: added space around ternary expressions#14912
mihaigmarin wants to merge 1 commit into
curl:masterfrom
mihaigmarin:feature/tidy-ups

Conversation

@mihaigmarin

Copy link
Copy Markdown
Contributor

Added space around ternary expressions to be in accordance with code style

Comment thread src/tool_getparam.c
size_t len;
bool use_stdin = !strcmp(&nextarg[1], "-");
FILE *file = use_stdin?stdin:fopen(&nextarg[1], FOPEN_READTEXT);
FILE *file = use_stdin ? stdin : fopen(&nextarg[1], FOPEN_READTEXT);

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression

This argument to a file access function is derived from [user input (a command-line argument)](1) and then passed to fopen(__filename).
@bagder

bagder commented Sep 15, 2024

Copy link
Copy Markdown
Member

I think this is fine, although this PR also leaves out a lot of other instances using the same pattern.

It made me add more checks to checksrc for this, which made me find many other nits but I'll do them in a separate PR.

@mihaigmarin

mihaigmarin commented Sep 15, 2024

Copy link
Copy Markdown
Contributor Author

Sure, glad to help.

@bagder bagder closed this in 5a26371 Sep 18, 2024
@bagder

bagder commented Sep 18, 2024

Copy link
Copy Markdown
Member

Thanks!

@mihaigmarin

Copy link
Copy Markdown
Contributor Author

Anytime

pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants