From b52dc7e9075f13f3568735b2abf508dbda2705ff Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Tue, 16 Aug 2011 11:46:44 +0200 Subject: [PATCH] Off-by-one error in uses_rfcomm Variable len could be assigned to PATH_MAX + 1 length (returned from readlink) and this variable is used as index to array link of size only PATH_MAX + 1. --- compat/dun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/dun.c b/compat/dun.c index 59f036fe1..de98830aa 100644 --- a/compat/dun.c +++ b/compat/dun.c @@ -104,7 +104,7 @@ static int uses_rfcomm(char *path, char *dev) while ((de = readdir(dir)) != NULL) { char link[PATH_MAX + 1]; - int len = readlink(de->d_name, link, sizeof(link)); + int len = readlink(de->d_name, link, PATH_MAX); if (len > 0) { link[len] = 0; if (strstr(link, dev)) { -- 2.47.3