int
obj_read(struct fastbuf *f, struct odes *o)
{
- byte buf[1024];
+ byte buf[MAX_ATTR_SIZE];
while (bgets(f, buf, sizeof(buf)))
{
for(struct oattr *a=d->attrs; a; a=a->next)
for(struct oattr *b=a; b; b=b->same)
{
+ byte *z;
bputc(f, a->attr);
- for(byte *z = b->val; *z; z++)
+ for(z = b->val; *z; z++)
if (*z >= ' ' || *z == '\t')
bputc(f, *z);
else
bputc(f, '?');
log(L_ERROR, "obj_dump: Found non-ASCII characters (URL might be %s)", obj_find_aval(d, 'U'));
}
+ ASSERT(z - b->val <= MAX_ATTR_SIZE-2);
bputc(f, '\n');
}
}
#ifndef _SHERLOCK_OBJECT_H
#define _SHERLOCK_OBJECT_H
+#define MAX_ATTR_SIZE 1024 /* Maximum length an attribute can ever have (including name and trailing 0) */
+
struct fastbuf;
struct odes { /* Object description */