Bug 13439

Summary: found overlapping data buffer
Product: Drivers Reporter: Martin Ettl (ettl.martin)
Component: OtherAssignee: drivers_other
Status: RESOLVED CODE_FIX    
Severity: normal CC: alan
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.29.3 Subsystem:
Regression: No Bisected commit-id:

Description Martin Ettl 2009-06-03 14:33:45 UTC
Hello,

i detected an overlapping data buffer at file 
"linux-2.6.29.3/drivers/staging/rt2860/common/cmm_info"
For detection, i used the static code analysis tool cppcheck. It prints the
following message:
[linux-2.6.29.3/drivers/staging/rt2860/common/cmm_info.c:2920]: (error) Overlapping data buffer pBuf



Take a loop at file cmm_info.c at line 545:

sprintf(pBuf, "%s%s\n", pBuf, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name);


Here, pBuf is used by iteself, this is dangerous!!!!

Best regards

Ettl Martin
Comment 1 Martin Ettl 2009-06-03 14:36:12 UTC
I had a typo.... not line 2920 is correct:

Take a loop at file cmm_info.c at line 2920:

sprintf(pBuf, "%s%s\n", pBuf, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name);