0
0
mirror of https://github.com/rkd77/elinks.git synced 2025-09-21 19:46:23 -04:00

Cast the NULL argument of straconcat to unsigned char *.

straconcat reads the args with va_arg(ap, const unsigned char *),
and the NULL macro may have the wrong type (e.g. int).

Many places pass string literals of type char * to straconcat.  This
is in principle also a violation, but I'm ignoring it for now because
if it becomes a problem with some C implementation, then so will the
use of unsigned char * with printf "%s", which is so widespread in
ELinks that I'm not going to try fixing it now.
This commit is contained in:
Kalle Olavi Niemitalo
2007-03-11 12:59:11 +02:00
committed by Kalle Olavi Niemitalo
parent 22af2b22e2
commit 7645a836fc
30 changed files with 87 additions and 53 deletions

View File

@@ -285,10 +285,10 @@ ecmascript_set_action(unsigned char **action, unsigned char *string)
struct uri *uri = get_uri(*action, URI_HTTP_REFERRER_HOST);
if (uri->protocol == PROTOCOL_FILE) {
mem_free_set(action, straconcat(struri(uri), string, NULL));
mem_free_set(action, straconcat(struri(uri), string, (unsigned char *) NULL));
}
else
mem_free_set(action, straconcat(struri(uri), string + 1, NULL));
mem_free_set(action, straconcat(struri(uri), string + 1, (unsigned char *) NULL));
done_uri(uri);
mem_free(string);
} else { /* relative uri */
@@ -296,7 +296,8 @@ ecmascript_set_action(unsigned char **action, unsigned char *string)
unsigned char *new_action;
if (last_slash) *(last_slash + 1) = '\0';
new_action = straconcat(*action, string, NULL);
new_action = straconcat(*action, string,
(unsigned char *) NULL);
mem_free_set(action, new_action);
mem_free(string);
}