Skip to content

Conversation

eriksjolund
Copy link
Contributor

No description provided.

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
@kwilczynski
Copy link
Member

/approve
/lgtm

it = ".";

len = snprintf (path, PATH_MAX, "%s/%s", it, executable_path);
if (len == PATH_MAX)
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible for len to be > PATH_MAX? snprintf would ensure it is not, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, at least that is how I understand the man page
https://man7.org/linux/man-pages/man3/fprintf.3p.html#RETURN_VALUE

This PR matches this example:

if (UNLIKELY (n >= max_len))

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

@giuseppe giuseppe merged commit f12b2da into containers:main Oct 29, 2024
57 checks passed
@eriksjolund eriksjolund deleted the check-for-truncation branch October 29, 2024 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants