qatzip/1-fix-snprintf-truncation.patch
Vladis Dronov 0f7016fb9d Rebuild for qatzip v1.0.7
Fix snprintf truncation check (bz 2046925, github.com/intel/QATzip/pull/57)
Add -fstack-protector-strong build option (bz 2044889)

Signed-off-by: Vladis Dronov <vdronov@redhat.com>
2022-02-09 15:31:17 +01:00

15 lines
489 B
Diff

--- utils/qzip.c.orig
+++ utils/qzip.c
@@ -469,9 +469,8 @@ int makeOutName(const char *in_name, const char *out_name,
* parent directory. */
void mkPath(char *path, const char *dirpath, char *file)
{
- if (strlen(dirpath) + strlen(file) + 1 < MAX_PATH_LEN) {
- snprintf(path, MAX_PATH_LEN, "%s/%s", dirpath, file);
- } else {
+ if (snprintf(path, MAX_PATH_LEN, "%s/%s", dirpath, file) >= MAX_PATH_LEN) {
+ /* truncation occurred */
assert(0);
}
}