Need to check the return value of hashmap_first() since it could be
negative.
This commit is contained in:
		
							parent
							
								
									6992c74bba
								
							
						
					
					
						commit
						0e7182533c
					
				@ -1,3 +1,9 @@
 | 
				
			|||||||
 | 
					2002-04-26  Robert James Kaes  <rjkaes@flarenet.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* src/reqs.c (process_client_headers):
 | 
				
			||||||
 | 
						(process_server_headers): Test the return value of hashmap_first()
 | 
				
			||||||
 | 
						since the hashmap could be empty (returning a -1 via hashmap_first.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
2002-04-25  Robert James Kaes  <rjkaes@flarenet.com>
 | 
					2002-04-25  Robert James Kaes  <rjkaes@flarenet.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* src/reqs.c (remove_connection_headers): Handle both the
 | 
						* src/reqs.c (remove_connection_headers): Handle both the
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										16
									
								
								src/reqs.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								src/reqs.c
									
									
									
									
									
								
							@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: reqs.c,v 1.67 2002-04-25 19:20:56 rjkaes Exp $
 | 
					/* $Id: reqs.c,v 1.68 2002-04-26 16:43:20 rjkaes Exp $
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * This is where all the work in tinyproxy is actually done. Incoming
 | 
					 * This is where all the work in tinyproxy is actually done. Incoming
 | 
				
			||||||
 * connections have a new thread created for them. The thread then
 | 
					 * connections have a new thread created for them. The thread then
 | 
				
			||||||
@ -769,9 +769,9 @@ process_client_headers(struct conn_s *connptr)
 | 
				
			|||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Output all the remaining headers to the remote machine.
 | 
						 * Output all the remaining headers to the remote machine.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	for (iter = hashmap_first(hashofheaders);
 | 
						iter = hashmap_first(hashofheaders);
 | 
				
			||||||
	     !hashmap_is_end(hashofheaders, iter);
 | 
						if (iter >= 0) {
 | 
				
			||||||
	     ++iter) {
 | 
							for ( ; !hashmap_is_end(hashofheaders, iter); ++iter) {
 | 
				
			||||||
			hashmap_return_entry(hashofheaders,
 | 
								hashmap_return_entry(hashofheaders,
 | 
				
			||||||
					     iter,
 | 
										     iter,
 | 
				
			||||||
					     &data,
 | 
										     &data,
 | 
				
			||||||
@ -783,6 +783,7 @@ process_client_headers(struct conn_s *connptr)
 | 
				
			|||||||
					      data, header);
 | 
										      data, header);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Free the hashofheaders since it's no longer needed */
 | 
						/* Free the hashofheaders since it's no longer needed */
 | 
				
			||||||
	hashmap_delete(hashofheaders);
 | 
						hashmap_delete(hashofheaders);
 | 
				
			||||||
@ -879,9 +880,9 @@ process_server_headers(struct conn_s *connptr)
 | 
				
			|||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Okay, output all the remaining headers to the client.
 | 
						 * Okay, output all the remaining headers to the client.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	for (iter = hashmap_first(hashofheaders);
 | 
						iter = hashmap_first(hashofheaders);
 | 
				
			||||||
	     !hashmap_is_end(hashofheaders, iter);
 | 
						if (iter >= 0) {
 | 
				
			||||||
	     ++iter) {
 | 
							for ( ; !hashmap_is_end(hashofheaders, iter); ++iter) {
 | 
				
			||||||
			hashmap_return_entry(hashofheaders,
 | 
								hashmap_return_entry(hashofheaders,
 | 
				
			||||||
					     iter,
 | 
										     iter,
 | 
				
			||||||
					     &data,
 | 
										     &data,
 | 
				
			||||||
@ -891,6 +892,7 @@ process_server_headers(struct conn_s *connptr)
 | 
				
			|||||||
				      "%s: %s\r\n",
 | 
									      "%s: %s\r\n",
 | 
				
			||||||
				      data, header);
 | 
									      data, header);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	hashmap_delete(hashofheaders);
 | 
						hashmap_delete(hashofheaders);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Write the final blank line to signify the end of the headers */
 | 
						/* Write the final blank line to signify the end of the headers */
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user