Revision: 14254 Author: adrian.chadd Date: Wed Jul 29 19:59:01 2009 Log: Try to work around Issue 50 - improper use of strCut() leading to a crash when using x-forwarded-for
The x-forwarded-for iterator parser is a bit evil and should be rewritten. Among other things, it uses strCut() incorrectly. Work around it in strCut() for now. http://code.google.com/p/lusca-cache/source/detail?r=14254 Modified: /branches/LUSCA_HEAD/libmem/String.c ======================================= --- /branches/LUSCA_HEAD/libmem/String.c Thu Feb 5 11:33:02 2009 +++ /branches/LUSCA_HEAD/libmem/String.c Wed Jul 29 19:59:01 2009 @@ -192,9 +192,23 @@ return -1; } +/* + * Cut the given string at the given offset. + * "offset" -should- be less than the length of the string but + * at least the client_side X-Forwarded-For code currently (ab)uses + * the API and passes in an out of bounds iterator. In this case, + * don't cut the string. + */ extern void strCut(String *s, int offset) { + /* + * XXX this should eventually be removed and all code + * XXX which triggers it should be fixed! + */ + if (offset >= strLen(*s)) + return; + assert(offset < strLen(*s)); s->buf[offset] = '\0'; s->len = offset; --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "lusca-commit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/lusca-commit?hl=en -~----------~----~----~----~------~----~------~--~---
