projects
/
privoxy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9877d94
)
Simplify cgi_error_unknown() a bit.
author
Fabian Keil
<fk@fabiankeil.de>
Sat, 25 Jun 2011 12:39:41 +0000
(12:39 +0000)
committer
Fabian Keil
<fk@fabiankeil.de>
Sat, 25 Jun 2011 12:39:41 +0000
(12:39 +0000)
cgi.c
patch
|
blob
|
history
diff --git
a/cgi.c
b/cgi.c
index
0583f88
..
96af186
100644
(file)
--- a/
cgi.c
+++ b/
cgi.c
@@
-1,4
+1,4
@@
-const char cgi_rcs[] = "$Id: cgi.c,v 1.13
0 2011/04/19 13:00:47
fabiankeil Exp $";
+const char cgi_rcs[] = "$Id: cgi.c,v 1.13
1 2011/06/23 14:01:01
fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgi.c,v $
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgi.c,v $
@@
-1212,12
+1212,8
@@
jb_err cgi_error_unknown(const struct client_state *csp,
"file a bug report</a>.</p>\r\n"
"</body>\r\n"
"</html>\r\n";
"file a bug report</a>.</p>\r\n"
"</body>\r\n"
"</html>\r\n";
- char errnumbuf[30];
- /*
- * Due to sizeof(errnumbuf), body_size will be slightly
- * bigger than necessary but it doesn't really matter.
- */
- const size_t body_size = strlen(body_prefix) + sizeof(errnumbuf) + strlen(body_suffix) + 1;
+ /* Includes room for larger error numbers in the future. */
+ const size_t body_size = sizeof(body_prefix) + sizeof(body_suffix) + 5;
assert(csp);
assert(rsp);
assert(csp);
assert(rsp);
@@
-1230,16
+1226,13
@@
jb_err cgi_error_unknown(const struct client_state *csp,
rsp->is_static = 0;
rsp->crunch_reason = INTERNAL_ERROR;
rsp->is_static = 0;
rsp->crunch_reason = INTERNAL_ERROR;
- snprintf(errnumbuf, sizeof(errnumbuf), "%d", error_to_report);
-
rsp->body = malloc(body_size);
if (rsp->body == NULL)
{
return JB_ERR_MEMORY;
}
rsp->body = malloc(body_size);
if (rsp->body == NULL)
{
return JB_ERR_MEMORY;
}
- strlcpy(rsp->body, body_prefix, body_size);
- strlcat(rsp->body, errnumbuf, body_size);
- strlcat(rsp->body, body_suffix, body_size);
+
+ snprintf(rsp->body, body_size, "%s%d%s", body_prefix, error_to_report, body_suffix);
rsp->status = strdup(status);
if (rsp->status == NULL)
rsp->status = strdup(status);
if (rsp->status == NULL)