about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2006-12-28 01:54:43 +0100
committerLars Hjemli <hjemli@gmail.com>2006-12-28 01:54:43 +0100
commit27cd3b2a700e1cc46cd0393ddea48c07b62ee3a6 (patch)
tree041158893604fa4127bc0df31a2c22f8d48b852f
parentMinor style fixes (diff)
downloadcgit-pink-27cd3b2a700e1cc46cd0393ddea48c07b62ee3a6.tar.gz
cgit-pink-27cd3b2a700e1cc46cd0393ddea48c07b62ee3a6.zip
Test for NULL-pointers in html_txt() and friends
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r--html.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/html.c b/html.c
index 957b326..3a5d28d 100644
--- a/html.c
+++ b/html.c
@@ -45,7 +45,7 @@ void htmlf(const char *format, ...)
 void html_txt(char *txt)
 {
 	char *t = txt;
-	while(*t){
+	while(t && *t){
 		int c = *t;
 		if (c=='<' || c=='>' || c=='&') {
 			*t = '\0';
@@ -68,7 +68,7 @@ void html_txt(char *txt)
 void html_ntxt(int len, char *txt)
 {
 	char *t = txt;
-	while(*t && len--){
+	while(t && *t && len--){
 		int c = *t;
 		if (c=='<' || c=='>' || c=='&') {
 			*t = '\0';
@@ -97,7 +97,7 @@ void html_ntxt(int len, char *txt)
 void html_attr(char *txt)
 {
 	char *t = txt;
-	while(*t){
+	while(t && *t){
 		int c = *t;
 		if (c=='<' || c=='>' || c=='\'') {
 			*t = '\0';
@@ -155,4 +155,3 @@ void html_filemode(unsigned short mode)
 	html_fileperm(mode >> 3);
 	html_fileperm(mode);
 }
-
red.c?h=1.4.1&id=e429fb0cca1e8c78da0ec38fe578bafdeec65534&follow=1'>Return http statuscode 404 on unknown branchLars Hjemli 2009-06-07Add head-include configuration option.Mark Lodato 2009-03-15CGIT 0.8.2.1Lars Hjemli 2009-03-15Fix doc-related glitches in Makefile and .gitignoreLars Hjemli 2009-03-15ui-snapshot: avoid segfault when no filename is specifiedLars Hjemli 2009-03-15fix segfault when displaying empty blobsEric Wong 2009-02-19Add support for HEAD requestsLars Hjemli 2009-02-19Add support for ETag in 'plain' viewLars Hjemli 2009-02-12ui-tree: escape ascii-text properly in hexdump viewLars Hjemli 2009-02-12Makefile: add doc-related targetsLars Hjemli