return "application/octet-stream";
}
-static const char * uh_file_mktag(struct stat *s, char *buf)
+static const char * uh_file_mktag(struct stat *s, char *buf, int len)
{
- snprintf(buf, sizeof(buf), "\"%x-%x-%x\"",
+ snprintf(buf, len, "\"%x-%x-%x\"",
(unsigned int) s->st_ino,
(unsigned int) s->st_size,
(unsigned int) s->st_mtime);
char buf[128];
if (s) {
- ustream_printf(cl->us, "ETag: %s\r\n", uh_file_mktag(s, buf));
+ ustream_printf(cl->us, "ETag: %s\r\n", uh_file_mktag(s, buf, sizeof(buf)));
ustream_printf(cl->us, "Last-Modified: %s\r\n",
uh_file_unix2date(s->st_mtime, buf, sizeof(buf)));
}
static bool uh_file_if_match(struct client *cl, struct stat *s)
{
char buf[128];
- const char *tag = uh_file_mktag(s, buf);
+ const char *tag = uh_file_mktag(s, buf, sizeof(buf));
char *hdr = uh_file_header(cl, HDR_IF_MATCH);
char *p;
int i;
static int uh_file_if_none_match(struct client *cl, struct stat *s)
{
char buf[128];
- const char *tag = uh_file_mktag(s, buf);
+ const char *tag = uh_file_mktag(s, buf, sizeof(buf));
char *hdr = uh_file_header(cl, HDR_IF_NONE_MATCH);
char *p;
int i;