Browse Source

fixed a potential buffer overflow bug on the stack (thanks to Ghassan Misherg)

master 0.4
Anselm R. Garbe 18 years ago
parent
commit
6725bb2a3a
  1. 2
      LICENSE
  2. 2
      Makefile
  3. 2
      config.mk
  4. 4
      slock.c

2
LICENSE

@ -1,6 +1,6 @@
MIT/X Consortium License MIT/X Consortium License
(C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"), copy of this software and associated documentation files (the "Software"),

2
Makefile

@ -1,5 +1,5 @@
# slock - simple screen locker # slock - simple screen locker
# (C)opyright MMVI Anselm R. Garbe # (C)opyright MMVI-MMVII Anselm R. Garbe
include config.mk include config.mk

2
config.mk

@ -1,5 +1,5 @@
# slock version # slock version
VERSION = 0.3 VERSION = 0.4
# Customize below to fit your system # Customize below to fit your system

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. * See LICENSE file for license details.
*/ */
#define _XOPEN_SOURCE 500 #define _XOPEN_SOURCE 500
@ -122,7 +122,7 @@ main(int argc, char **argv) {
--len; --len;
break; break;
default: default:
if(num && !iscntrl((int) buf[0])) { if(num && !iscntrl((int) buf[0]) && (len + num < sizeof passwd)) {
memcpy(passwd + len, buf, num); memcpy(passwd + len, buf, num);
len += num; len += num;
} }

Loading…
Cancel
Save