mirror of
git://git.suckless.org/slock
synced 2025-07-31 20:22:09 -07:00
fixed a potential buffer overflow bug on the stack (thanks to Ghassan Misherg)
This commit is contained in:
4
slock.c
4
slock.c
@@ -1,4 +1,4 @@
|
||||
/* (C)opyright MMIV-MMV Anselm R. Garbe <garbeam at gmail dot com>
|
||||
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
#define _XOPEN_SOURCE 500
|
||||
@@ -122,7 +122,7 @@ main(int argc, char **argv) {
|
||||
--len;
|
||||
break;
|
||||
default:
|
||||
if(num && !iscntrl((int) buf[0])) {
|
||||
if(num && !iscntrl((int) buf[0]) && (len + num < sizeof passwd)) {
|
||||
memcpy(passwd + len, buf, num);
|
||||
len += num;
|
||||
}
|
||||
|
Reference in New Issue
Block a user