checkpoint-restore / criu

Checkpoint/Restore tool
criu.org
Other
2.79k stars 565 forks source link

tun: don't parse buffers that have not been filled with data #2278

Closed avagin closed 9 months ago

avagin commented 9 months ago

read_ns_sys_file() can return an error, but we are trying to parse a buffer before checking a return code.

CID 417395 (#3 of 3): String not null terminated (STRING_NULL)

  1. string_null: Passing unterminated string buf to strtol, which expects a null-terminated string.
codecov-commenter commented 9 months ago

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Comparison is base (c20fb83) 70.55% compared to head (7fe073d) 70.54%. Report is 3 commits behind head on criu-dev.

:exclamation: Current head 7fe073d differs from pull request most recent head 8c1091c. Consider uploading reports for the commit 8c1091c to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## criu-dev #2278 +/- ## ============================================ - Coverage 70.55% 70.54% -0.01% ============================================ Files 132 132 Lines 33511 33513 +2 ============================================ Hits 23643 23643 - Misses 9868 9870 +2 ``` | [Files](https://app.codecov.io/gh/checkpoint-restore/criu/pull/2278?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=checkpoint-restore) | Coverage Δ | | |---|---|---| | [criu/tun.c](https://app.codecov.io/gh/checkpoint-restore/criu/pull/2278?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=checkpoint-restore#diff-Y3JpdS90dW4uYw==) | `73.93% <100.00%> (-0.23%)` | :arrow_down: | | [criu/net.c](https://app.codecov.io/gh/checkpoint-restore/criu/pull/2278?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=checkpoint-restore#diff-Y3JpdS9uZXQuYw==) | `76.60% <60.00%> (-0.09%)` | :arrow_down: | | [criu/util.c](https://app.codecov.io/gh/checkpoint-restore/criu/pull/2278?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=checkpoint-restore#diff-Y3JpdS91dGlsLmM=) | `63.10% <14.28%> (-0.19%)` | :arrow_down: | ... and [2 files with indirect coverage changes](https://app.codecov.io/gh/checkpoint-restore/criu/pull/2278/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=checkpoint-restore)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.