View | Details | Raw Unified | Return to bug 59194
Collapse All | Expand All

(-)gaim-0.75/src/protocols/zephyr/ZInit.c (-1 / +2 lines)
Lines 32-38 Code_t ZInitialize() Link Here
32
{
32
{
33
    struct servent *hmserv;
33
    struct servent *hmserv;
34
    struct hostent *hostent;
34
    struct hostent *hostent;
35
    char addr[4], hostname[MAXHOSTNAMELEN];
35
    char addr[4], hostname[MAXHOSTNAMELEN+1];
36
    struct in_addr servaddr;
36
    struct in_addr servaddr;
37
    struct sockaddr_in sin;
37
    struct sockaddr_in sin;
38
    int s, sinsize = sizeof(sin);
38
    int s, sinsize = sizeof(sin);
Lines 134-139 Code_t ZInitialize() Link Here
134
	 * is a pretty broken thing to do, and unfortunately what we
134
	 * is a pretty broken thing to do, and unfortunately what we
135
	 * always do on server machines.) */
135
	 * always do on server machines.) */
136
	if (gethostname(hostname, sizeof(hostname)) == 0) {
136
	if (gethostname(hostname, sizeof(hostname)) == 0) {
137
	    hostname[sizeof(hostname)-1] = '\0';
137
	    hostent = gethostbyname(hostname);
138
	    hostent = gethostbyname(hostname);
138
	    if (hostent && hostent->h_addrtype == AF_INET)
139
	    if (hostent && hostent->h_addrtype == AF_INET)
139
		memcpy(&__My_addr, hostent->h_addr, sizeof(__My_addr));
140
		memcpy(&__My_addr, hostent->h_addr, sizeof(__My_addr));
(-)gaim-0.75/src/util.c (-10 / +37 lines)
Lines 2133-2146 parse_redirect(const char *data, size_t Link Here
2133
static size_t
2133
static size_t
2134
parse_content_len(const char *data, size_t data_len)
2134
parse_content_len(const char *data, size_t data_len)
2135
{
2135
{
2136
	int content_len = 0;
2136
	size_t content_len = 0;
2137
	char *tmp;
2137
	const char *p = NULL;
2138
2138
2139
	tmp = g_malloc(data_len + 1);
2139
	/* This is still technically wrong, since headers are case-insensitive
2140
	memcpy(tmp, data, data_len);
2140
	 * [RFC 2616, section 4.2], though this ought to catch the normal case.
2141
	tmp[data_len] = '\0';
2141
	 * Note: data is _not_ nul-terminated.
2142
	sscanf(tmp, "Content-Length: %d", &content_len);
2142
	 */
2143
	g_free(tmp);
2143
	if (data_len > 16) {
2144
		p = strncmp(data, "Content-Length: ", 16) == 0? data: NULL;
2145
		if (!p) {
2146
			p = g_strstr_len(data, data_len, "\nContent-Length: ");
2147
			if (p)
2148
				p += 1;
2149
		}
2150
	}
2151
2152
	/* If we can find a Content-Length header at all, try to sscanf it.
2153
	 * Response headers should end with at least \r\n, so sscanf is safe,
2154
	 * if we make sure that there is indeed a \n in our header.
2155
	 */
2156
	if (p && g_strstr_len(p, data_len - (p - data), "\n")) {
2157
		sscanf(p, "Content-Length: %u", (int *)&content_len);
2158
		gaim_debug_misc("parse_content_len", "parsed %u\n", content_len);
2159
	}
2144
2160
2145
	return content_len;
2161
	return content_len;
2146
}
2162
}
Lines 2271-2277 url_fetched_cb(gpointer url_data, gint s Link Here
2271
2287
2272
					/* In with the new. */
2288
					/* In with the new. */
2273
					gfud->data_len = content_len;
2289
					gfud->data_len = content_len;
2274
					gfud->webdata = g_malloc(gfud->data_len);
2290
					gfud->webdata = g_try_malloc(gfud->data_len);
2291
					if (gfud->webdata == NULL) {
2292
						gaim_debug_error("gaim_url_fetch", "Failed to allocate %u bytes: %s\n", gfud->data_len, strerror(errno));
2293
						gaim_input_remove(gfud->inpa);
2294
						close(sock);
2295
						gfud->callback(gfud->user_data, NULL, 0);
2296
						destroy_fetch_url_data(gfud);
2297
					}
2298
2275
				}
2299
				}
2276
				else
2300
				else
2277
					gfud->newline = TRUE;
2301
					gfud->newline = TRUE;
Lines 2349-2355 gaim_url_decode(const char *str) Link Here
2349
2373
2350
	g_return_val_if_fail(str != NULL, NULL);
2374
	g_return_val_if_fail(str != NULL, NULL);
2351
2375
2352
	for (i = 0; i < strlen(str); i++) {
2376
	for (i = 0; i < strlen(str) && j < sizeof(buf)-2; i++) {
2353
		char hex[3];
2377
		char hex[3];
2354
2378
2355
		if (str[i] != '%')
2379
		if (str[i] != '%')
Lines 2386-2394 gaim_url_encode(const char *str) Link Here
2386
	g_return_val_if_fail(str != NULL, NULL);
2410
	g_return_val_if_fail(str != NULL, NULL);
2387
2411
2388
	for (i = 0; i < strlen(str); i++) {
2412
	for (i = 0; i < strlen(str); i++) {
2389
		if (isalnum(str[i]))
2413
		if (isalnum(str[i])) {
2414
			if(j+1 >= sizeof(buf)-1) break;
2390
			buf[j++] = str[i];
2415
			buf[j++] = str[i];
2416
		}
2391
		else {
2417
		else {
2418
			if(j+3 >= sizeof(buf)-1) break;
2392
			sprintf(buf + j, "%%%02x", (unsigned char)str[i]);
2419
			sprintf(buf + j, "%%%02x", (unsigned char)str[i]);
2393
			j += 3;
2420
			j += 3;
2394
		}
2421
		}
(-)gaim-0.75/src/gtkprefs.c (-2 / +4 lines)
Lines 438-444 GtkTreePath *theme_refresh_theme_list() Link Here
438
438
439
void theme_install_theme(char *path, char *extn) {
439
void theme_install_theme(char *path, char *extn) {
440
#ifndef _WIN32
440
#ifndef _WIN32
441
	gchar *command;
441
	gchar *command, *escaped;
442
#endif
442
#endif
443
	gchar *destdir;
443
	gchar *destdir;
444
	gchar *tail;
444
	gchar *tail;
Lines 458-464 void theme_install_theme(char *path, cha Link Here
458
	 * other platforms, if need be */
458
	 * other platforms, if need be */
459
	if (!g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz")) {
459
	if (!g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz")) {
460
#ifndef _WIN32
460
#ifndef _WIN32
461
		command = g_strdup_printf("tar > /dev/null xzf \"%s\" -C %s", path, destdir);
461
		escaped = g_shell_quote(path);
462
		command = g_strdup_printf("tar > /dev/null xzf %s -C %s", escaped, destdir);
463
		g_free(escaped);
462
#else
464
#else
463
		if(!wgaim_gz_untar(path, destdir)) {
465
		if(!wgaim_gz_untar(path, destdir)) {
464
			g_free(destdir);
466
			g_free(destdir);

Return to bug 59194