summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-12-10 21:36:49 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-12-10 21:36:49 +0100
commite2ee21995ee43411965ec9f7e7a95f3c139850b2 (patch)
tree42997bdcfc1c8fc02a630ee6519c36508b9eda3d /main.c
parent4ab1899f5deb4764bde692d6b14c27eb862a6196 (diff)
fixed possible stack overflow bug after call to realpath
Diffstat (limited to 'main.c')
-rw-r--r--main.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/main.c b/main.c
index 856b855c..6df2c6c6 100644
--- a/main.c
+++ b/main.c
@@ -373,6 +373,9 @@ main (int argc, char *argv[]) {
// path of this process
if (argv[i][0] != '-' && realpath (argv[i], resolved)) {
len = strlen (resolved);
+ if (len >= size) {
+ break;
+ }
memcpy (p, resolved, len+1);
}
else {