Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
pickaxe: plug diff filespec leak with empty needle
author
René Scharfe
<rene.scharfe@lsrfire.ath.cx>
Thu, 6 Oct 2011 16:03:35 +0000
(18:03 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 7 Oct 2011 22:46:12 +0000
(15:46 -0700)
Check first for the unlikely case of an empty needle string and only
then populate the filespec, lest we leak it.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diffcore-pickaxe.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
703f05a
)
diff --git
a/diffcore-pickaxe.c
b/diffcore-pickaxe.c
index c3760cfefd5dd123481b869eac3081b6e7d93201..0835a3be8d7b54e6654def5e7793cc0a38eed647 100644
(file)
--- a/
diffcore-pickaxe.c
+++ b/
diffcore-pickaxe.c
@@
-152,10
+152,10
@@
static unsigned int contains(struct diff_filespec *one,
unsigned int cnt;
unsigned long sz;
const char *data;
unsigned int cnt;
unsigned long sz;
const char *data;
- if (diff_populate_filespec(one, 0))
- return 0;
if (!len)
return 0;
if (!len)
return 0;
+ if (diff_populate_filespec(one, 0))
+ return 0;
sz = one->size;
data = one->data;
sz = one->size;
data = one->data;