Index: gw/wap-appl.c
===================================================================
RCS file: /home/cvs/gateway/gw/wap-appl.c,v
retrieving revision 1.124
diff -a -u -r1.124 wap-appl.c
--- gw/wap-appl.c	12 Jan 2009 16:46:57 -0000	1.124
+++ gw/wap-appl.c	27 Mar 2009 18:08:06 -0000
@@ -1463,7 +1463,7 @@
                                       List **application_headers)
 {
     List *inh;
-    int i;
+    int i, len;
     Octstr *appid_name, *coded_octstr;
     char *appid_value, *coded_value;
 
@@ -1482,7 +1482,8 @@
     coded_value = NULL;
     appid_value = NULL;
 
-    while (gwlist_len(inh) > 0) {
+	 len = gwlist_len(inh);
+    while (i < len) {
         http_header_get(inh, i, &appid_name, &coded_octstr);
 
         /* Greatest value reserved by WINA is 0xFF00 0000*/
