From: nicm Date: Sat, 25 Apr 2015 18:44:28 +0000 (+0000) Subject: Fail if a \ appears at EOL rather than continuing off the end of the X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2dae82d532b8713ee1a305d401be75c91d5802fa;p=openbsd Fail if a \ appears at EOL rather than continuing off the end of the buffer, from Sebastien Marie. --- 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;