Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Mar 1997 23:29:13 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        cvs-all@freefall.freebsd.org, CVS-committers@freefall.freebsd.org, cvs-usrbin@freefall.freebsd.org, yokota@freefall.freebsd.org
Subject:   Re: cvs commit:  src/usr.bin/w pr_time.c w.c
Message-ID:  <199703071229.XAA14372@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>  Modified:    usr.bin/w  pr_time.c w.c
>  Log:
>  Made sure the string formated by strftime() is properly
>  null-terminated.

Strings are null-terminated by definition.  According to the ANSI C
standard, strftime() gives either a string (if there is enough space)
or indeterminate buffer contents (otherwise) according to the ANSI C
standard.  The FreeBSD behaviour of truncating the string should not
be documented or depended on.  This means that the result of strftime()
should always be checked.  A fixed-size buffer may be too small because
the locale has long time-related strings.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703071229.XAA14372>