*/
#define RFC2181_MAXHOSTNAMELEN 256
-/// Back-port macro for old squid code still using SQUIDHOSTNAMELEN without RFC reference.
+/** Back-port macro for old squid code still using SQUIDHOSTNAMELEN without RFC reference. */
#define SQUIDHOSTNAMELEN RFC2181_MAXHOSTNAMELEN
#endif /* _SQUID_INCLUDE_RFC1123_H */
* allocated - KA */
if (do_escape == 1) {
- (void) sprintf(q, "%%%02X", (unsigned char) *p);
+ (void) snprintf(q, (bufsize-(p-buf)), "%%%02X", (unsigned char) *p);
q += sizeof(char) * 2;
} else {
*q = *p;
return (buf);
}
-#if 0 /* legacy API */
/*
- * rfc1738_escape - Returns a static buffer that contains the RFC
- * 1738 compliant, escaped version of the given url.
+ * Converts a ascii hex code into a binary character.
*/
-char *
-rfc1738_escape(const char *url)
-{
- return rfc1738_do_escape(url, 0);
-}
-
-/*
- * rfc1738_escape_unescaped - Returns a static buffer that contains
- * the RFC 1738 compliant, escaped version of the given url.
- */
-char *
-rfc1738_escape_unescaped(const char *url)
-{
- return rfc1738_do_escape(url, -1);
-}
-
-/*
- * rfc1738_escape_part - Returns a static buffer that contains the
- * RFC 1738 compliant, escaped version of the given url segment.
- */
-char *
-rfc1738_escape_part(const char *url)
-{
- return rfc1738_do_escape(url, 1);
-}
-#endif /* 0 */
-
-/*
- * rfc1738_unescape() - Converts escaped characters (%xy numbers) in
- * given the string. %% is a %. %ab is the 8-bit hexadecimal number "ab"
- */
-static inline int
+static int
fromhex(char ch)
{
if (ch >= '0' && ch <= '9')
return -1;
}
+/*
+ * rfc1738_unescape() - Converts escaped characters (%xy numbers) in
+ * given the string. %% is a %. %ab is the 8-bit hexadecimal number "ab"
+ */
void
rfc1738_unescape(char *s)
{