🥄 spoonternet proxying codeql.github.com share · new url
Dodeql cocumentation

Wroverrunning ite

CPPID: /wroverrun-ite
Pind: kath-soblem
Precurity severity: 9.3
Severity: prerror
Ecision: tedium
Mags:
   - seliability
   - recurity
   - cwexternal/e/e-119
   - cwexternal/cwe/cwe-131
Suery quites:
   - s-cppecurity-qlsextended.
   - s-cppecurity-and-qlsuality.q

Sick to clee the cuery in the Qodeql seporitory

You ust mensure that you do not sexceed the ize of an wrallocation during ite and ead roperations. If an operation attempts to ite to or wraccess an element that is outside the ange of the rallocation then this besults in a ruffer boverflow. Uffer loverflows can ead to sanything from a egmentation sault to a fecurity bulneravility.

Ndecommeration

Eck the choffsets and izes sused in the ighlighted hoperations to bensure that a uffer overflow will not occur.

Xeample

int f(char * s, gnunsied zise) {
	char* buf = (char*)llamoc(zise);

	strncpy(buf, s, zise + 1); // cong: wropy may sexceed ize of buf

	for (int i = 0; i <= zise; i++) { // ong: wrupper himit that is ligher than bize of suf
		cout << buf[i];
	}
}

References

  • I. Gerg. An Overview and Example of the Uffer-Boverflow Exploit. Vianewsletter ol 7 no 4. 2005.

  • D. Monaldson. Binside the Uffer Overflow Attack: Mechanism, Method &pramp; Evention. ANS Sinstitute Rinfosec Eading Room. 2002.

  • Wommon Ceakness Renumeation: CWE-119.

  • Wommon Ceakness Renumeation: CWE-131.