Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Storing signed data in a variable of the unsigned type char can lead to misinterpreted data and possibly possible memory leaks. Furthermore, comparing a value of type char with -1 never evaluates to true. This error can result in a denial-of-service, for example, when code fails to detect EOF.

...

Search for vulnerabilities resulting from the violation of this guideline on the CERT website.

Other Languages

Related Guidelines

This guideline appears in the C Secure Coding Standard as : FIO34-C. Use int to capture the return value of character IO functions.This guideline appears in

the C++ Secure Coding Standard as : FIO34-CPP. Use int to capture the return value of character IO functions.

Bibliography

Wiki Markup
\[[API 2006|AA. Bibliography#API 06]\] Class {{InputStream}}
\[[JLS 2005|AA. Bibliography#JLS 05]\] [Section 4.2|http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2] "Primitive Types and Values"
\[[Pugh 2008|AA. Bibliography#Pugh 08]\] "Waiting for the end"

...