[gitg] Fix segvs in arguments and environment parsing in GitgCommand



commit 771cb4a19d7faa0161d4d6dd70fb2eb4e74c7670
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Fri Aug 19 23:21:47 2011 +0200

    Fix segvs in arguments and environment parsing in GitgCommand

 libgitg/gitg-command.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/libgitg/gitg-command.c b/libgitg/gitg-command.c
index b025d1e..f6ef51e 100644
--- a/libgitg/gitg-command.c
+++ b/libgitg/gitg-command.c
@@ -342,12 +342,12 @@ gitg_command_add_argumentsv (GitgCommand         *command,
 
 	args = g_ptr_array_new ();
 
-	for (ptr = command->priv->arguments; *ptr; ++ptr)
+	for (ptr = command->priv->arguments; ptr && *ptr; ++ptr)
 	{
 		g_ptr_array_add (args, *ptr);
 	}
 
-	while (*arguments)
+	while (arguments && *arguments)
 	{
 		g_ptr_array_add (args, g_strdup (*arguments++));
 	}
@@ -427,14 +427,14 @@ gitg_command_add_environmentv (GitgCommand         *command,
 
 	args = g_ptr_array_new ();
 
-	for (ptr = command->priv->environment; *ptr; ++ptr)
+	for (ptr = command->priv->environment; ptr && *ptr; ++ptr)
 	{
 		g_ptr_array_add (args, *ptr);
 	}
 
 	combined = combine_environment (environment);
 
-	for (ptr = combined; *ptr; ++ptr)
+	for (ptr = combined; ptr && *ptr; ++ptr)
 	{
 		g_ptr_array_add (args, *ptr);
 	}



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