Project

General

Profile

Bug #1855

malloc wrong size in mod_accesslog

Added by ycheng about 11 years ago. Updated almost 11 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
mod_accesslog
Target version:
Start date:
2008-12-22
Due date:
% Done:

100%

Estimated time:
Missing in 1.5.x:

Description

http://redmine.lighttpd.net/repositories/entry/lighttpd/branches/lighttpd-1.4.x/src/mod_accesslog.c

Function:
int accesslog_parse_format(server *srv, format_fields *fields, buffer *format)

Line 172:
fields->ptr = malloc(fields->size * sizeof(format_fields * ));
should be
fields->ptr = malloc(fields->size * sizeof(format_field * ));
Line 175:
fields->ptr = realloc(fields->ptr, fields->size * sizeof(format_fields * ));
should be
fields->ptr = realloc(fields->ptr, fields->size * sizeof(format_field * ));

They are all pointers, so it may be not so serious. But
Line 178:
fields->ptr[fields->used] = malloc(sizeof(format_fields));
should be
fields->ptr[fields->used] = malloc(sizeof(format_field));

Lighttpd runs ok because format_field and format_fields are the same size.

If I was right. It happened many times below in this function.

#1

Updated by icy almost 11 years ago

  • Priority changed from Urgent to Normal
  • Target version set to 1.4.21
#2

Updated by stbuehler almost 11 years ago

Good catch! Thank you.

#3

Updated by stbuehler almost 11 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Applied in changeset r2379.

Also available in: Atom