Project

General

Profile

Actions

Bug #1855

closed

malloc wrong size in mod_accesslog

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

Status:
Fixed
Priority:
Normal
Category:
mod_accesslog
Target version:
ASK QUESTIONS IN Forums:

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.

Actions #1

Updated by icy almost 16 years ago

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

Updated by stbuehler almost 16 years ago

Good catch! Thank you.

Actions #3

Updated by stbuehler almost 16 years ago

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

Applied in changeset r2379.

Actions

Also available in: Atom