35 vulnerabilities classified as CWE-170 (不恰当的空终结符). AI Chinese analysis included.
CWE-170 represents a critical memory management weakness where software fails to properly terminate strings or arrays with a null character. This defect typically arises from off-by-one errors that write terminators out of bounds, causing buffer overflows, or from incorrect usage of functions like strncpy() that omit the necessary null byte. Attackers exploit these vulnerabilities to execute arbitrary code, crash applications, or bypass security controls by manipulating memory boundaries. To mitigate this risk, developers must rigorously validate buffer sizes and explicitly ensure null termination after every string operation. Utilizing safer, language-specific string handling libraries that automatically manage termination, combined with static analysis tools to detect missing terminators, significantly reduces the likelihood of introducing this dangerous flaw into production code.
#define MAXLEN 1024 ... char *pathbuf[MAXLEN]; ... read(cfgfile,inputbuf,MAXLEN); //does not null terminate strcpy(pathbuf,inputbuf); //requires null terminated input ...char buf[MAXPATH]; ... readlink(pathname, buf, MAXPATH); int length = strlen(buf); ...Vulnerabilities classified as CWE-170 (不恰当的空终结符) represent 35 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.