Recent changes (master)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The following changes since commit 24baa4c70c850d4c1703ae8f4e2b35fc5c5a57ea:

  genzipf: use regular array + qsort() instead of rbtree (2012-11-12 20:54:12 -0700)

are available in the git repository at:
  git://git.kernel.dk/fio.git master

Jens Axboe (1):
      json: fix off-by-one in memory alloc

 json.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

---

Diff of recent changes:

diff --git a/json.c b/json.c
index ea61af7..cdc3b21 100644
--- a/json.c
+++ b/json.c
@@ -63,18 +63,22 @@ static char *strdup_escape(const char *str)
 	char *p, *ret;
 	int escapes;
 
+	if (!strlen(str))
+		return NULL;
+
 	escapes = 0;
 	while ((input = strpbrk(input, "\\\"")) != NULL) {
 		escapes++;
 		input++;
 	}
 
-	p = ret = malloc(strlen(str) + escapes);
+	p = ret = malloc(strlen(str) + escapes + 1);
 	while (*str) {
 		if (*str == '\\' || *str == '\"')
 			*p++ = '\\';
 		*p++ = *str++;
 	}
+	*p = '\0';
 
 	return ret;
 }
--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux