[balsa/gtk3] Check loop index value before using it



commit 17f2ee0783061ae8de4f611cf8647f8c81105c90
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Jul 22 15:30:23 2012 -0400

    Check loop index value before using it
    
    	* libbalsa/message.c (prepend_header_misc): check loop index
    	value before using it.

 ChangeLog          |    5 +++++
 libbalsa/message.c |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0ff1626..23f59d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-07-22  Peter Bloomfield
 
+	* libbalsa/message.c (prepend_header_misc): check loop index
+	value before using it.
+
+2012-07-22  Peter Bloomfield
+
 	* libbalsa/mailbox_pop3.c (mp_load_uids): reduce scope of
 	variable.
 
diff --git a/libbalsa/message.c b/libbalsa/message.c
index eded049..511c801 100644
--- a/libbalsa/message.c
+++ b/libbalsa/message.c
@@ -446,7 +446,7 @@ prepend_header_misc(const char *name, const char *value,
 	/* Empty header */
 	return;
     /* Standard Headers*/
-    for(i=0; name[i] && i<sizeof(lcname)-1; i++)
+    for(i=0; i<sizeof(lcname)-1 && name[i]; i++)
         lcname[i] = tolower(name[i]);
     if (i < sizeof(lcname)) {
 	/* short enough to be on the ignored-headers list */



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