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));
}
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,
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 " */
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;