jdk/src/share/bin/parse_manifest.c
Print this page
rev 5684 : 7200500: Launcher better input validation
Reviewed-by: darcy, jjh, mschoene
*** 488,500 ****
if ((fd = open(jarfile, O_RDONLY
#ifdef O_BINARY
| O_BINARY /* use binary mode on windows */
#endif
! )) == -1)
return (-1);
!
info->manifest_version = NULL;
info->main_class = NULL;
info->jre_version = NULL;
info->jre_restrict_search = 0;
info->splashscreen_image_file_name = NULL;
--- 488,500 ----
if ((fd = open(jarfile, O_RDONLY
#ifdef O_BINARY
| O_BINARY /* use binary mode on windows */
#endif
! )) == -1) {
return (-1);
! }
info->manifest_version = NULL;
info->main_class = NULL;
info->jre_version = NULL;
info->jre_restrict_search = 0;
info->splashscreen_image_file_name = NULL;
*** 537,552 ****
JLI_JarUnpackFile(const char *jarfile, const char *filename, int *size) {
int fd;
zentry entry;
void *data = NULL;
! 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) {
data = inflate_file(fd, &entry, size);
}
close(fd);
return (data);
}
--- 537,554 ----
JLI_JarUnpackFile(const char *jarfile, const char *filename, int *size) {
int fd;
zentry entry;
void *data = NULL;
! if ((fd = open(jarfile, O_RDONLY
#ifdef O_BINARY
| O_BINARY /* use binary mode on windows */
#endif
! )) == -1) {
! return NULL;
! }
! if (find_file(fd, &entry, filename) == 0) {
data = inflate_file(fd, &entry, size);
}
close(fd);
return (data);
}
*** 584,595 ****
if ((fd = open(jarfile, O_RDONLY
#ifdef O_BINARY
| O_BINARY /* use binary mode on windows */
#endif
! )) == -1)
return (-1);
if (rc = find_file(fd, &entry, manifest_name) != 0) {
close(fd);
return (-2);
}
--- 586,598 ----
if ((fd = open(jarfile, O_RDONLY
#ifdef O_BINARY
| O_BINARY /* use binary mode on windows */
#endif
! )) == -1) {
return (-1);
+ }
if (rc = find_file(fd, &entry, manifest_name) != 0) {
close(fd);
return (-2);
}