diff options
author | Jonathan Larmour <jifl@eCosCentric.com> | 2001-06-11 17:21:18 +0000 |
---|---|---|
committer | Jonathan Larmour <jifl@eCosCentric.com> | 2001-06-11 17:21:18 +0000 |
commit | 43b44bc5ad877a2244750ba721142cae0a35d20b (patch) | |
tree | 58f8a6f24009f656449c918e90bfbdbc9b254118 /newlib | |
parent | f375b8d9f413dc386e52c860a55db74b8095e72a (diff) | |
download | newlib-43b44bc5ad877a2244750ba721142cae0a35d20b.zip newlib-43b44bc5ad877a2244750ba721142cae0a35d20b.tar.gz newlib-43b44bc5ad877a2244750ba721142cae0a35d20b.tar.bz2 |
* libc/stdlib/mbtowc_r.c (_mbtowc_r): Avoid dereferencing
NULL pointer.
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/ChangeLog | 5 | ||||
-rw-r--r-- | newlib/libc/stdlib/mbtowc_r.c | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index d83c52f..81b62e4 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2001-06-08 Jonathan Larmour <jlarmour@redhat.com> + + * libc/stdlib/mbtowc_r.c (_mbtowc_r): Avoid dereferencing + NULL pointer. + 2001-05-28 Nick Clifton <nickc@cambridge.redhat.com> * libc/stdio/vfprintf.c (_VFPRINTF_R): Handle printf ("%#.0o",0) diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c index 7d718c8..4bf3023 100644 --- a/newlib/libc/stdlib/mbtowc_r.c +++ b/newlib/libc/stdlib/mbtowc_r.c @@ -68,9 +68,10 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state), { /* fall-through */ } else if (!strcmp (r->_current_locale, "C-SJIS")) { - int char1 = *t; + int char1; if (s == NULL) return 0; /* not state-dependent */ + char1 = *t; if (_issjis1 (char1)) { int char2 = t[1]; @@ -87,9 +88,10 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state), } else if (!strcmp (r->_current_locale, "C-EUCJP")) { - int char1 = *t; + int char1; if (s == NULL) return 0; /* not state-dependent */ + char1 = *t; if (_iseucjp (char1)) { int char2 = t[1]; |