The getline function distinguishes between the allocated and read lenghts, and we should not mix them up, as we might end up processing junk. Signed-off-by: Guillem Jover <guillem@xxxxxxxxxxx> --- login-utils/sulogin-consoles.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/login-utils/sulogin-consoles.c b/login-utils/sulogin-consoles.c index 9fd1034..39d24d2 100644 --- a/login-utils/sulogin-consoles.c +++ b/login-utils/sulogin-consoles.c @@ -154,13 +154,15 @@ char *oneline(const char *file) { FILE *fp; char *ret = NULL; - size_t len = 0; + size_t dummy = 0; + ssize_t len; DBG(dbgprint("reading %s", file)); if (!(fp = fopen(file, "re"))) return NULL; - if (getline(&ret, &len, fp) >= 0) { + len = getline(&ret, &dummy, fp); + if (len >= 0) { char *nl; if (len) -- 2.2.1.209.g41e5f3a -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html