version 1.98, 2014/09/27 11:17:36 |
version 1.100, 2014/10/28 17:36:19 |
|
|
format(const struct req *req, const char *file) |
format(const struct req *req, const char *file) |
{ |
{ |
struct mparse *mp; |
struct mparse *mp; |
|
struct mchars *mchars; |
struct mdoc *mdoc; |
struct mdoc *mdoc; |
struct man *man; |
struct man *man; |
void *vp; |
void *vp; |
Line 837 format(const struct req *req, const char *file) |
|
Line 838 format(const struct req *req, const char *file) |
|
return; |
return; |
} |
} |
|
|
|
mchars = mchars_alloc(); |
mp = mparse_alloc(MPARSE_SO, MANDOCLEVEL_FATAL, NULL, |
mp = mparse_alloc(MPARSE_SO, MANDOCLEVEL_FATAL, NULL, |
req->q.manpath); |
mchars, req->q.manpath); |
rc = mparse_readfd(mp, fd, file); |
rc = mparse_readfd(mp, fd, file); |
close(fd); |
close(fd); |
|
|
Line 864 format(const struct req *req, const char *file) |
|
Line 866 format(const struct req *req, const char *file) |
|
req->q.manpath, file); |
req->q.manpath, file); |
pg_error_internal(); |
pg_error_internal(); |
mparse_free(mp); |
mparse_free(mp); |
|
mchars_free(mchars); |
return; |
return; |
} |
} |
|
|
vp = html_alloc(opts); |
vp = html_alloc(mchars, opts); |
|
|
if (NULL != mdoc) |
if (NULL != mdoc) |
html_mdoc(vp, mdoc); |
html_mdoc(vp, mdoc); |
Line 876 format(const struct req *req, const char *file) |
|
Line 879 format(const struct req *req, const char *file) |
|
|
|
html_free(vp); |
html_free(vp); |
mparse_free(mp); |
mparse_free(mp); |
|
mchars_free(mchars); |
free(opts); |
free(opts); |
} |
} |
|
|
|
|
|
|
/* Poor man's ReDoS mitigation. */ |
/* Poor man's ReDoS mitigation. */ |
|
|
itimer.it_value.tv_sec = 1; |
itimer.it_value.tv_sec = 2; |
itimer.it_value.tv_usec = 0; |
itimer.it_value.tv_usec = 0; |
itimer.it_interval.tv_sec = 1; |
itimer.it_interval.tv_sec = 2; |
itimer.it_interval.tv_usec = 0; |
itimer.it_interval.tv_usec = 0; |
if (setitimer(ITIMER_VIRTUAL, &itimer, NULL) == -1) { |
if (setitimer(ITIMER_VIRTUAL, &itimer, NULL) == -1) { |
fprintf(stderr, "setitimer: %s\n", strerror(errno)); |
fprintf(stderr, "setitimer: %s\n", strerror(errno)); |