return i ? i->util : NULL;
}
+__attribute__((format (printf, 2, 3)))
static void format_write(int fd, const char *fmt, ...)
{
static char buffer[1024];
safe_write(1, "\r\n", 2);
}
+__attribute__((format (printf, 1, 2)))
static NORETURN void not_found(const char *err, ...)
{
va_list params;
exit(0);
}
+__attribute__((format (printf, 1, 2)))
static NORETURN void forbidden(const char *err, ...)
{
va_list params;
if (regcomp(&re, c->pattern, REG_EXTENDED))
die("Bogus regex in service table: %s", c->pattern);
if (!regexec(&re, dir, 1, out, 0)) {
- size_t n = out[0].rm_eo - out[0].rm_so;
+ size_t n;
if (strcmp(method, c->method)) {
const char *proto = getenv("SERVER_PROTOCOL");
}
cmd = c;
+ n = out[0].rm_eo - out[0].rm_so;
cmd_arg = xmalloc(n);
- strncpy(cmd_arg, dir + out[0].rm_so + 1, n);
- cmd_arg[n] = '\0';
+ memcpy(cmd_arg, dir + out[0].rm_so + 1, n-1);
+ cmd_arg[n-1] = '\0';
dir[out[0].rm_so] = 0;
break;
}