# HG changeset patch # User coffeys # Date 1353019348 0 # Node ID 27bb245457d801fab2a5a835e42a4adefdf7ce85 # Parent 46582c3c96b3fdd43b58761c3869ce55fad1c755 7200500: Launcher better input validation Reviewed-by: ksrini diff --git a/src/share/bin/parse_manifest.c b/src/share/bin/parse_manifest.c --- jdk/src/share/bin/parse_manifest.c +++ jdk/src/share/bin/parse_manifest.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -487,9 +487,9 @@ JLI_ParseManifest(char *jarfile, manifes #ifdef O_BINARY | O_BINARY /* use binary mode on windows */ #endif - )) == -1) + )) == -1) { return (-1); - + } info->manifest_version = NULL; info->main_class = NULL; info->jre_version = NULL; @@ -536,12 +536,14 @@ JLI_JarUnpackFile(const char *jarfile, c zentry entry; void *data = NULL; - fd = open(jarfile, O_RDONLY + if ((fd = open(jarfile, O_RDONLY #ifdef O_BINARY | O_BINARY /* use binary mode on windows */ #endif - ); - if (fd != -1 && find_file(fd, &entry, filename) == 0) { + )) == -1) { + return NULL; + } + if (find_file(fd, &entry, filename) == 0) { data = inflate_file(fd, &entry, size); } close(fd); @@ -583,9 +585,9 @@ JLI_ManifestIterate(const char *jarfile, #ifdef O_BINARY | O_BINARY /* use binary mode on windows */ #endif - )) == -1) + )) == -1) { return (-1); - + } if (rc = find_file(fd, &entry, manifest_name) != 0) { close(fd); return (-2);