Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 1 | From e25d00d8297cba044c3a4d2e38749e54adac66c1 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sat, 22 Dec 2018 19:59:02 -0800 |
| 4 | Subject: [PATCH] misc: Do not print NULL string into logs |
| 5 | |
| 6 | string format %s is getting a NULL pointer for 'expand' |
| 7 | parameter always since the check for chunks[i] == NULL will ensure that |
| 8 | its always null when the Log() API is called |
| 9 | |
| 10 | Upstream-Status: Submitted [https://github.com/vmware/open-vm-tools/pull/312] |
| 11 | |
| 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 13 | --- |
| 14 | open-vm-tools/lib/misc/util_misc.c | 4 ++-- |
| 15 | 1 file changed, 2 insertions(+), 2 deletions(-) |
| 16 | |
| 17 | diff --git open-vm-tools/lib/misc/util_misc.c b/open-vm-tools/lib/misc/util_misc.c |
| 18 | index 198c23d2..0ac0a335 100644 |
| 19 | --- open-vm-tools/lib/misc/util_misc.c |
| 20 | +++ open-vm-tools/lib/misc/util_misc.c |
| 21 | @@ -719,8 +719,8 @@ Util_ExpandString(const char *fileName) // IN file path to expand |
| 22 | ASSERT(!freeChunk[i]); |
| 23 | chunks[i] = expand; |
| 24 | if (chunks[i] == NULL) { |
| 25 | - Log("%s: Cannot allocate memory to expand \"%s\" in \"%s\".\n", |
| 26 | - __FUNCTION__, expand, fileName); |
| 27 | + Log("%s: Cannot allocate memory to expand in \"%s\".\n", |
| 28 | + __FUNCTION__, fileName); |
| 29 | goto out; |
| 30 | } |
| 31 | chunkSize[i] = strlen(expand); |