The toupper() and tolower() functions did not do appropriate
range checking, and would shift the value of any ASCII character passed
+/- 32, respectively, without regard to whether the characters so shifted
were letters or not. This corrects the problem, although, like the rest
of the C library, does not take internationalized character sets into account.
AUTHOR: Wiljo Heinen (wiljo@freeside.ki.open.de)
386BSD-Patchkit: patch00027
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
+ *
+ * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
+ * -------------------- ----- ----------------------
+ * CURRENT PATCH LEVEL: 1 00027
+ * -------------------- ----- ----------------------
+ *
+ * 02 Aug 92 Wiljo Heinen Fixed toupper()/tolower() range check
*/
#if defined(LIBC_SCCS) && !defined(lint)
*/
#if defined(LIBC_SCCS) && !defined(lint)
- return((c) - 'A' + 'a');
+/* was: return((c) - 'A' + 'a');*/
+ return ( isupper(c) ? c - 'A' + 'a' : c);
}
#undef toupper
toupper(c)
int c;
{
}
#undef toupper
toupper(c)
int c;
{
- return((c) - 'a' + 'A');
+/* was: return((c) - 'a' + 'A');*/
+ return ( islower(c) ? c - 'a' + 'A' : c);