1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Revert "strcpy -> strlcpy."

This reverts commit 365cbb61be.
There is no strlcpy in libc.
This commit is contained in:
Witold Filipczyk 2010-09-19 15:26:05 +02:00 committed by witekfl
parent 365cbb61be
commit f93d5ccd80
4 changed files with 13 additions and 16 deletions

View File

@ -206,12 +206,10 @@ set_language(int language)
/* We never free() this, purely intentionally. */ /* We never free() this, purely intentionally. */
LANGUAGE = malloc(256); LANGUAGE = malloc(256);
} }
if (LANGUAGE) { strcpy(LANGUAGE, language_to_iso639(language));
strlcpy(LANGUAGE, language_to_iso639(language), 256);
p = strchr(LANGUAGE, '-'); p = strchr(LANGUAGE, '-');
if (p) if (p)
*p = '_'; *p = '_';
}
/* Propagate the change to gettext. From the info manual. */ /* Propagate the change to gettext. From the info manual. */
{ {

View File

@ -142,9 +142,10 @@ __(unsigned char *file, unsigned int line, unsigned char *func,
file, line, func, last_line); file, line, func, last_line);
} }
strlcpy(last_file, file, 512); /* Risky ;) */
strlcpy(last_func, func, 1024); strcpy(last_file, file);
strlcpy(last_result, result, 16384); strcpy(last_func, func);
strcpy(last_result, result);
last_line = line; last_line = line;
return result; return result;

View File

@ -155,9 +155,9 @@ get_charset_aliases(void)
res_size = 0; res_size = 0;
break; break;
} }
strlcpy(res_ptr + res_size - (l2 + 1) - (l1 + 1), strcpy(res_ptr + res_size - (l2 + 1) - (l1 + 1),
buf1, l1 + 1 + l2 + 1 + 1); buf1);
strlcpy(res_ptr + res_size - (l2 + 1), buf2, l2 + 1); strcpy(res_ptr + res_size - (l2 + 1), buf2);
} }
fclose(fp); fclose(fp);
if (res_size == 0) if (res_size == 0)

View File

@ -874,7 +874,6 @@ join_urls(struct uri *base, unsigned char *rel)
int add_slash = 0; int add_slash = 0;
int translate = 0; int translate = 0;
int length = 0; int length = 0;
int rel_len;
/* See RFC 1808 */ /* See RFC 1808 */
/* TODO: Support for ';' ? (see the RFC) --pasky */ /* TODO: Support for ';' ? (see the RFC) --pasky */
@ -989,13 +988,12 @@ join_urls(struct uri *base, unsigned char *rel)
} }
length = path - struri(base); length = path - struri(base);
rel_len = strlen(rel); uristring = mem_alloc(length + strlen(rel) + add_slash + 1);
uristring = mem_alloc(length + rel_len + add_slash + 1);
if (!uristring) return NULL; if (!uristring) return NULL;
memcpy(uristring, struri(base), length); memcpy(uristring, struri(base), length);
if (add_slash) uristring[length] = '/'; if (add_slash) uristring[length] = '/';
strlcpy(uristring + length + add_slash, rel, rel_len + 1); strcpy(uristring + length + add_slash, rel);
return normalize_uri_reparse(uristring); return normalize_uri_reparse(uristring);
} }