0f7016fb9d
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>
15 lines
489 B
Diff
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);
|
|
}
|
|
}
|