libpurple/protocols/zephyr/ZParseNot.c

changeset 40643
1c9bdf8d3e85
parent 40624
6f7bbd42d36c
child 40653
503cfa50c8c3
equal deleted inserted replaced
40642:18050336a45f 40643:1c9bdf8d3e85
7 * For copying and distribution information, see the file 7 * For copying and distribution information, see the file
8 * "mit-copyright.h". 8 * "mit-copyright.h".
9 */ 9 */
10 10
11 #include "internal.h" 11 #include "internal.h"
12
13 #include <gio/gio.h>
12 14
13 #include <purple.h> 15 #include <purple.h>
14 16
15 /* Assume that strlen is efficient on this machine... */ 17 /* Assume that strlen is efficient on this machine... */
16 #define next_field(ptr) ptr += strlen (ptr) + 1 18 #define next_field(ptr) ptr += strlen (ptr) + 1
109 next_field (ptr); 111 next_field (ptr);
110 112
111 /*XXX 3 */ 113 /*XXX 3 */
112 numfields -= 2; /* numfields, version, and checksum */ 114 numfields -= 2; /* numfields, version, and checksum */
113 if (numfields < 0) { 115 if (numfields < 0) {
116 GInetAddress *inet_addr = NULL;
117 gchar *inet_addr_str = NULL;
114 badpkt: 118 badpkt:
115 #if 0 119 inet_addr = g_inet_address_new_from_bytes(
120 (const guint8 *)&notice->z_uid.zuid_addr,
121 G_SOCKET_FAMILY_IPV4);
122 inet_addr_str = g_inet_address_to_string(inet_addr);
116 #ifdef __LINE__ 123 #ifdef __LINE__
117 lineno = __LINE__; 124 lineno = __LINE__;
118 purple_debug_error("zephyr", "ZParseNotice: bad packet from %s/%d (line %d)", inet_ntoa (notice->z_uid.zuid_addr.s_addr), notice->z_port, lineno); 125 purple_debug_error("zephyr", "ZParseNotice: bad packet from %s/%d (line %d)",
126 inet_addr_str, notice->z_port, lineno);
119 #else 127 #else
120 purple_debug_error("zephyr", "ZParseNotice: bad packet from %s/%d", inet_ntoa (notice->z_uid.zuid_addr.s_addr), notice->z_port); 128 purple_debug_error("zephyr", "ZParseNotice: bad packet from %s/%d",
121 #endif 129 inet_addr_str, notice->z_port);
122 #endif 130 #endif
131 g_free(inet_addr_str);
132 g_object_unref(inet_addr);
123 return ZERR_BADPKT; 133 return ZERR_BADPKT;
124 } 134 }
125 135
126 if (numfields) { 136 if (numfields) {
127 if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) 137 if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD)

mercurial