summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/vfwscanf.c
Commit message (Collapse)AuthorAgeFilesLines
* Renumber clauses to reduce diffs to other versionsemaste2013-04-231-1/+1
| | | | | | | NetBSD, OpenBSD, and Android's Bionic all number the clauses 1 through 3, so follow suit to make comparison easier. Acked-by: imp@
* Remove incorrect __restrict qualifier on several pointersdumbbell2012-04-301-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The typical case was: static __inline int convert_ccl(FILE *fp, char * __restrict p, [...]) { [...] if (p == SUPPRESS_PTR) { [...] } else { [...] } [...] } This qualifier says that the pointer is the only one at that time pointing to the resource. Here, clang considers that "p" will never match "SUPPRESS_PTR" and optimize the if{} block out. This leads to segfaults in programs calling vfscanf(3) and vfwscanf(3) with just the format string (no arguments following it). The following softwares were reported to abort with segmentation fault and this patch fixes it: o cmake o smartd o devel/ORBit2 dim@ opened an LLVM PR to discuss this clang optimization: http://llvm.org/bugs/show_bug.cgi?id=12656 Tested by: bsam@
* Fix a bug in *wscanf's handling of non-wide %s, %c, and %[das2012-04-301-44/+9
| | | | | | | | | | | | | conversions. Both the specification and the documentation say the width is interpreted as the max number of wide characters to read, but the implementation was interpreting it as the number of bytes to convert. (See also r105317.) This change has security implications for any applications that depend on the buggy behavior, but the impact in practice is probably nil. Any such application would already be buggy on other platforms that get the semantics right. Also, these conversions are rarely used; %ls, %lc, and %l[ are more appropriate.
* Bugfix: Include whitespace characters in the count of the number ofdas2012-04-221-1/+1
| | | | characters read.
* Bugfix: %n doesn't count as a conversion, sodas2012-04-221-1/+0
| | | | sscanf("abc", "ab%ncd", &i) returns EOF, not 0.
* Refactor scanf to improve modularity. Conversions are now performeddas2012-04-221-300/+394
| | | | | | by separate conversion functions. This will hopefully make bugs more noticeable (I noticed several already) and provide opportunities to reduce code duplication.
* Implement xlocale APIs from Darwin, mainly for use by libc++. This adds atheraven2011-11-201-39/+49
| | | | | | | | | | | | load of _l suffixed versions of various standard library functions that use the global locale, making them take an explicit locale parameter. Also adds support for per-thread locales. This work was funded by the FreeBSD Foundation. Please test any code you have that uses the C standard locale functions! Reviewed by: das (gdtoa changes) Approved by: dim (mentor)
* - Add support for multibyte decimal_point encodings, e.g., U+066B.das2009-01-191-9/+17
| | | | | A forthcoming gdtoa import is needed to make this fully work. - Improve the way "nan(...)" is parsed.
* Remove some test instrumentation. (The Symbol.map changes broke it anyway.)das2007-12-091-4/+0
|
* Per Regents of the University of Calfornia letter, remove advertisingimp2007-01-091-4/+0
| | | | | | clause. # If I've done so improperly on a file, please let me know.
* Add missing #if's for NO_FLOATING_POINTphk2006-04-011-0/+2
|
* Include <sys/types.h> and <limits.h> ourselves, don't assume they are includedstefanf2005-08-201-0/+1
| | | | | | | | | | through <pthread.h>. gen/sem.c: Prerequisite for <_semaphore.h> net/getprotoent.c: USHRT_MAX net/getservent.c: USHRT_MAX stdio/ungetwc.c: MB_LEN_MAX stdio/vfwscanf.c: MB_LEN_MAX
* Remove bogus FBSDID.obrien2004-05-021-3/+1
|
* Merge vfscanf.c, v1.37:das2004-05-021-8/+7
| | | | - s/#ifdef FLOATING_POINT/#ifndef NO_FLOATING_POINT/
* Prepare to handle trivial state-dependent encodings. Full support fortjr2004-04-071-6/+11
| | | | | state-dependent encodings with locking shifts will come later if there is demand for it.
* Merge vfscanf.c,v 1.35.das2004-01-311-4/+10
|
* Make intentions explicit with additional parenthesis.nectar2004-01-061-4/+4
|
* Pass NULL instead of a pointer to a zeroed mbstate_t object.tjr2003-11-051-10/+6
|
* Fix two incorrect uses of sizeof: we need to divide the size of the buffertjr2003-07-051-11/+6
| | | | | | by sizeof(wchar_t) to get the number of wide characters it contains. Remove the !hardway micro-optimisation from the CT_INT case to avoid having to fix it for wide characters.
* Merge recent floating point conversion changes from vfscanf.c.tjr2003-07-051-93/+175
|
* No need to include floatio.h here: vfscanf() no longer uses anythingtjr2002-11-011-1/+0
| | | | it defines.
* The field width for single-byte string conversions (%c, %s, %[) is thetjr2002-10-171-33/+88
| | | | | | maximum number of bytes that may be stored in the array, not the maximum number of wide characters to read. The wording of the standard unfortunately does not make this clear.
* Remove an unneeded call to _sfrefill() that was missed in the conversiontjr2002-09-241-6/+0
| | | | | from vfscanf() to vfwscanf(). It doesn't hurt to have it there, but it's redundant since __fgetwc() will refill the buffer if it needs to.
* Add implementations of wscanf() and related functions: fwscanf(), swscanf(),tjr2002-09-231-0/+748
vfwscanf(), vswscanf(), vwscanf(). As the name suggests, these are wide- character versions of the scanf() family of functions.
OpenPOWER on IntegriCloud