From 2dae82d532b8713ee1a305d401be75c91d5802fa Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 25 Apr 2015 18:44:28 +0000 Subject: [PATCH] Fail if a \ appears at EOL rather than continuing off the end of the buffer, from Sebastien Marie. --- usr.bin/file/magic-load.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.bin/file/magic-load.c b/usr.bin/file/magic-load.c index 5f3d1f150bd..6e9b6835713 100644 --- a/usr.bin/file/magic-load.c +++ b/usr.bin/file/magic-load.c @@ -1,4 +1,4 @@ -/* $OpenBSD: magic-load.c,v 1.2 2015/04/24 16:45:32 nicm Exp $ */ +/* $OpenBSD: magic-load.c,v 1.3 2015/04/25 18:44:28 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott @@ -401,6 +401,8 @@ magic_get_string(char **line, char *out, size_t *outlen) } switch (c = *++cp) { + case '\0': /* end of line */ + return (-1); case ' ': *out++ = ' '; break; -- 2.20.1