Skip to content
Browse files

Don't call string_copy_rev() on empty string

graph_expand() calls graph_insert_column() with the empty string as id,
which in turns leads to string_copy_rev() reading outside the allowed
memory area looking for whitespace.

To avoid this, don't call string_copy_rev() if we know the string is
empty anyway.

Signed-off-by: Romain Francoise <romain@orebokech.com>

Moved the check to string_copy_rev().

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
  • Loading branch information...
1 parent c575a60 commit cd9815d1a594d483a1efc6135e3badc996603b7f @orebokech orebokech committed with Oct 28, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 tig.h
View
3 tig.h
@@ -260,6 +260,9 @@ string_copy_rev(char *dst, const char *src)
{
size_t srclen;
+ if (!*src)
+ return;
+
for (srclen = 0; srclen < SIZEOF_REV; srclen++)
if (isspace(src[srclen]))
break;

0 comments on commit cd9815d

Please sign in to comment.
Something went wrong with that request. Please try again.