- Don't ignore applying filters if the server didn't
specify a Content-Type. Bug reported by Amuro Namie.
- Allow to rewrite the request destination behind the client's back.
+- Fix socks requests on big-endian platforms. Patch provided by Song Weijia.
- Minor code clean-ups, filter and action file updates.
(Some of them reported by Davide Alberani, Markus Elfring
and Adam Piggott)
-const char gateway_rcs[] = "$Id: gateway.c,v 1.19 2007/01/25 14:09:45 fabiankeil Exp $";
+const char gateway_rcs[] = "$Id: gateway.c,v 1.20 2007/05/14 10:23:48 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/gateway.c,v $
*
* Revisions :
* $Log: gateway.c,v $
+ * Revision 1.20 2007/05/14 10:23:48 fabiankeil
+ * - Use strlcpy() instead of strcpy().
+ * - Use the same buffer for socks requests and socks responses.
+ * - Fix bogus warning about web_server_addr being used uninitialized.
+ *
* Revision 1.19 2007/01/25 14:09:45 fabiankeil
* - Save errors in socks4_connect() to csp->error_message.
* - Silence some gcc43 warnings, hopefully the right way.
unsigned char dstport[2]; /* destination port */
unsigned char dstip[4]; /* destination address */
char userid; /* first byte of userid */
+ char padding[3]; /* make sure sizeof(struct socks_op) is endian-independent. */
/* more bytes of the userid follow, terminated by a NULL */
};
strlcpy(&(c->userid), socks_userid, sizeof(buf) - sizeof(struct socks_op));
- csiz = sizeof(*c) + sizeof(socks_userid) - 1;
+ csiz = sizeof(*c) + sizeof(socks_userid) - sizeof(c->userid) - sizeof(c->padding);
switch (fwd->type)
{
* size of socks_op, plus the length of the userid plus
* its \0 byte (which we don't have to add because the
* first byte of the userid is counted twice as it's also
- * part of sock_op), plus the length of the target_host
+ * part of sock_op) minus the padding bytes (which are part
+ * of the userid as well), plus the length of the target_host
* (which is stored csiz bytes after the beginning of the buffer),
* plus another \0 byte.
*/
- assert(n == sizeof(struct socks_op) + strlen(&(c->userid)) + strlen(buf + csiz) + 1);
+ assert(n == sizeof(struct socks_op) + strlen(&(c->userid)) - sizeof(c->padding) + strlen(buf + csiz) + 1);
csiz = n;
}
break;