Commit 64c55cd
Address code review feedback: improve error handling and type safety
- Add error handling for ftell() and malloc() failures in readFile()
- Remove unnecessary #else block for deprecated glib function (always use new version)
- Change sfs_mksquashfs to accept size_t instead of int for offset parameter
- Handle negative contentLength from curl in fetch_runtime()
- Validate offset before casting to long in read_file_offset_length()
- Check snprintf return value for buffer overflow instead of reducing buffer size
- Add limits.h include for LONG_MAX
All changes improve code safety and correctness as suggested by @black-sliver.
Co-authored-by: probonopd <[email protected]>1 parent 696f67d commit 64c55cd
3 files changed
+40
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| |||
464 | 464 | | |
465 | 465 | | |
466 | 466 | | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
467 | 474 | | |
468 | 475 | | |
469 | 476 | | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
470 | 485 | | |
471 | 486 | | |
472 | 487 | | |
| |||
696 | 711 | | |
697 | 712 | | |
698 | 713 | | |
699 | | - | |
700 | 714 | | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | 715 | | |
705 | 716 | | |
706 | 717 | | |
| |||
777 | 788 | | |
778 | 789 | | |
779 | 790 | | |
780 | | - | |
781 | | - | |
| 791 | + | |
782 | 792 | | |
783 | 793 | | |
784 | 794 | | |
| |||
804 | 814 | | |
805 | 815 | | |
806 | 816 | | |
| 817 | + | |
807 | 818 | | |
808 | | - | |
| 819 | + | |
809 | 820 | | |
810 | | - | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
811 | 826 | | |
812 | 827 | | |
813 | 828 | | |
| |||
932 | 947 | | |
933 | 948 | | |
934 | 949 | | |
935 | | - | |
| 950 | + | |
936 | 951 | | |
937 | 952 | | |
938 | 953 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
283 | 289 | | |
284 | | - | |
| 290 | + | |
285 | 291 | | |
286 | 292 | | |
287 | 293 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
177 | 178 | | |
178 | 179 | | |
179 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
180 | 187 | | |
181 | 188 | | |
182 | 189 | | |
| |||
0 commit comments