From 6725bb2a3a425ffff9c2253d60c0f25513c78a93 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Sat, 13 Jan 2007 14:09:41 +0100 Subject: fixed a potential buffer overflow bug on the stack (thanks to Ghassan Misherg) --- slock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'slock.c') diff --git a/slock.c b/slock.c index aafc7c0..94cb26b 100644 --- a/slock.c +++ b/slock.c @@ -1,4 +1,4 @@ -/* (C)opyright MMIV-MMV Anselm R. Garbe +/* (C)opyright MMVI-MMVII Anselm R. Garbe * 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; } -- cgit v1.2.3-70-g09d2