bug-sh-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

date bug - freeing unallocated memory


From: Albert Bartoszko
Subject: date bug - freeing unallocated memory
Date: Tue, 8 Jan 2002 14:43:40 +0100

Synopis:

If  option -f  is used without -u to invoke date (and sh-utils are compiled
without lint defined) SIGSEGV occurs (freeing unalocated memory)

Solution:

Delete line 217, 218, 220 in date.c

Example:

x - empty file

address@hidden src]# ./date --version
date (GNU sh-utils) 2.0
Written by David MacKenzie.

Copyright (C) 1999 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
address@hidden src]# ./date -f x
Segmentation fault (core dumped)

Source:
--------------------------------------date.c--------------------------------
-----
...
...
    206 static int
    207 batch_convert (const char *input_filename, const char *format)
    208 {
    209   int status;
    210   FILE *in_stream;
    211   char *line;
    212   int line_length;
    213   size_t buflen;
    214   time_t when;
    215   char *initial_TZ;
    216
    217 #ifdef lint
    218   /* Suppress `may be used before initialized' warning.  */
    219   initial_TZ = NULL;
    220 #endif
    221
...
 288   free (initial_TZ);


Albert Bartoszko





reply via email to

[Prev in Thread] Current Thread [Next in Thread]