Prevent buffer overflows by urlencode()
This commit is contained in:
parent
1bcc672503
commit
10e9289921
|
@ -68,10 +68,10 @@ char* gen_html(const char *url, struct Entry *entries, size_t numentries, int up
|
|||
size_t allocated;
|
||||
size_t i;
|
||||
|
||||
const unsigned int BUFSIZE = 2*PATH_MAX;
|
||||
const size_t BUFSIZE = 5*PATH_MAX;
|
||||
char buf[BUFSIZE];
|
||||
char fullpath[PATH_MAX];
|
||||
char encName[2*PATH_MAX];
|
||||
char encName[3*PATH_MAX]; // urlencode grows string by factor 3 at most
|
||||
|
||||
// allocate a buffer for the result string
|
||||
allocated = strlen(HEADER1 HEADER2 FOOTER) + 64 * numentries + 4096;
|
||||
|
|
Loading…
Reference in a new issue