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