summaryrefslogtreecommitdiffabout
path: root/shared.c
authorLars Hjemli <larsh@hal-2004.(none)>2007-01-04 15:53:03 (UTC)
committer Lars Hjemli <larsh@hal-2004.(none)>2007-01-04 15:57:00 (UTC)
commit52e605caf573fa20fdd4fbac5e1cc69b7740b1f5 (patch) (unidiff)
tree62c7bfb147f93a850f430185961a89ee51b8470a /shared.c
parent05b13194b4b40a2614692125d5037ef20c5fb20e (diff)
downloadcgit-52e605caf573fa20fdd4fbac5e1cc69b7740b1f5.zip
cgit-52e605caf573fa20fdd4fbac5e1cc69b7740b1f5.tar.gz
cgit-52e605caf573fa20fdd4fbac5e1cc69b7740b1f5.tar.bz2
Handle %xx encoding in querystring
Convert valid %xx expressions in querystring to ascii, ignore invalid expressions (i.e. eat the three characters %xx). Signed-off-by: Lars Hjemli <larsh@hal-2004.(none)>
Diffstat (limited to 'shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--shared.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/shared.c b/shared.c
index 7def51a..e4595fa 100644
--- a/shared.c
+++ b/shared.c
@@ -104,12 +104,25 @@ void cgit_querystring_cb(const char *name, const char *value)
104} 104}
105 105
106void *cgit_free_commitinfo(struct commitinfo *info) 106void *cgit_free_commitinfo(struct commitinfo *info)
107{ 107{
108 free(info->author); 108 free(info->author);
109 free(info->author_email); 109 free(info->author_email);
110 free(info->committer); 110 free(info->committer);
111 free(info->committer_email); 111 free(info->committer_email);
112 free(info->subject); 112 free(info->subject);
113 free(info); 113 free(info);
114 return NULL; 114 return NULL;
115} 115}
116
117int hextoint(char c)
118{
119 if (c >= 'a' && c <= 'f')
120 return 10 + c - 'a';
121 else if (c >= 'A' && c <= 'F')
122 return 10 + c - 'A';
123 else if (c >= '0' && c <= '9')
124 return c - '0';
125 else
126 return -1;
127}
128