author | Lars 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) |
commit | 52e605caf573fa20fdd4fbac5e1cc69b7740b1f5 (patch) (side-by-side diff) | |
tree | 62c7bfb147f93a850f430185961a89ee51b8470a /shared.c | |
parent | 05b13194b4b40a2614692125d5037ef20c5fb20e (diff) | |
download | cgit-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)>
-rw-r--r-- | shared.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -104,12 +104,25 @@ void cgit_querystring_cb(const char *name, const char *value) } void *cgit_free_commitinfo(struct commitinfo *info) { free(info->author); free(info->author_email); free(info->committer); free(info->committer_email); free(info->subject); free(info); return NULL; } + +int hextoint(char c) +{ + if (c >= 'a' && c <= 'f') + return 10 + c - 'a'; + else if (c >= 'A' && c <= 'F') + return 10 + c - 'A'; + else if (c >= '0' && c <= '9') + return c - '0'; + else + return -1; +} + |