Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sprintf buffer overflows #1084

Closed
setharnold opened this issue Feb 22, 2018 · 0 comments
Closed

sprintf buffer overflows #1084

setharnold opened this issue Feb 22, 2018 · 0 comments
Labels
removed_components Issues that affect MJ2, JPWL or JP3D wontfix

Comments

@setharnold
Copy link
Contributor

sprintf(name, "%s%d-%d.pgx", outfile, sliceno + 1, compno);

            if (volume->numcomps > 1) {
                sprintf(name, "%s%d-%d.pgx", outfile, sliceno + 1, compno);
            } else if ((volume->z1 - volume->z0) > 1) {
                sprintf(name, "%s%d.pgx", outfile, sliceno + 1);
            } else {
                sprintf(name, "%s.pgx", outfile);

Hello, the values I found for MAX_PATH (260) and OPJ_PATH_LEN (4096) that I found suggest these sprintf(3) calls could overflow. Perhaps asprintf(3) would be the easiest re-write, but that uses GNU-specific extensions that might not be available on all target platforms. If you swap to snprintf(3) please check for both less than zero and greater than allocated length return values.

Thanks

@rouault rouault closed this as completed May 6, 2021
@rouault rouault added wontfix removed_components Issues that affect MJ2, JPWL or JP3D labels May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
removed_components Issues that affect MJ2, JPWL or JP3D wontfix
Projects
None yet
Development

No branches or pull requests

2 participants