mirror of
https://github.com/apache/httpd.git
synced 2025-07-29 12:37:06 +00:00
Code cleanup: replace strncpy by apr_cpystrn or apr_pstrmemdup
Submitted by: Takashi Sato <takashi lans tv com> PR: 43432 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@981086 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@ -2313,9 +2313,7 @@ static char *do_expand(char *input, rewrite_ctx *ctx, rewriterule_entry *entry)
|
||||
if (entry && (entry->flags & RULEFLAG_ESCAPEBACKREF)) {
|
||||
/* escape the backreference */
|
||||
char *tmp2, *tmp;
|
||||
tmp = apr_palloc(pool, span + 1);
|
||||
strncpy(tmp, bri->source + bri->regmatch[n].rm_so, span);
|
||||
tmp[span] = '\0';
|
||||
tmp = apr_pstrmemdup(pool, bri->source + bri->regmatch[n].rm_so, span);
|
||||
tmp2 = escape_uri(pool, tmp);
|
||||
rewritelog((ctx->r, 5, ctx->perdir, "escaping backreference '%s' to '%s'",
|
||||
tmp, tmp2));
|
||||
|
@ -1275,8 +1275,7 @@ static int parse(server_rec *serv, apr_pool_t *p, char *l, int lineno)
|
||||
}
|
||||
else
|
||||
m->nospflag = 0;
|
||||
strncpy(m->desc, l, sizeof(m->desc) - 1);
|
||||
m->desc[sizeof(m->desc) - 1] = '\0';
|
||||
apr_cpystrn(m->desc, l, sizeof(m->desc));
|
||||
|
||||
#if MIME_MAGIC_DEBUG
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, serv,
|
||||
|
@ -1197,7 +1197,7 @@ static int CommandLineInterpreter(scr_t screenID, const char *commandLine)
|
||||
if (strlen(commandLine) <= strlen(szCommand))
|
||||
return NOTMYCOMMAND;
|
||||
|
||||
strncpy (szcommandLine, commandLine, sizeof(szcommandLine)-1);
|
||||
apr_cpystrn(szcommandLine, commandLine, sizeof(szcommandLine));
|
||||
|
||||
/* All added commands begin with "APACHE2 " */
|
||||
|
||||
|
@ -85,10 +85,7 @@ if (errbuf_size > 0)
|
||||
apr_snprintf(errbuf, sizeof errbuf,
|
||||
"%s%s%-6d", message, addmessage, (int)preg->re_erroffset);
|
||||
else
|
||||
{
|
||||
strncpy(errbuf, message, errbuf_size - 1);
|
||||
errbuf[errbuf_size-1] = 0;
|
||||
}
|
||||
apr_cpystrn(errbuf, message, errbuf_size);
|
||||
}
|
||||
|
||||
return length + addlength;
|
||||
|
Reference in New Issue
Block a user