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

[root@xxx 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.
[root@xxx 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



_______________________________________________
Bug-sh-utils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-sh-utils

Reply via email to