From 1c59975f51eb8add7936661ad8f19ef37d5b8b61 Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Sun, 21 Jan 2001 00:43:22 +0000 Subject: [PATCH] TarEntry.java was validating the maximum length for filenames only in one place. The tar-task used another constructor. Simply copied the verification to the other constructor to do the check there also. Now throws a RuntimeException. Submitted By: "Nico Seessle" git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268494 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/tar/TarEntry.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/org/apache/tools/tar/TarEntry.java b/src/main/org/apache/tools/tar/TarEntry.java index a066f08d5..ef670417c 100644 --- a/src/main/org/apache/tools/tar/TarEntry.java +++ b/src/main/org/apache/tools/tar/TarEntry.java @@ -177,6 +177,12 @@ public class TarEntry implements TarConstants { this.groupName = new StringBuffer(""); this.devMajor = 0; this.devMinor = 0; + + if (this.name.length() > NAMELEN) { + throw new RuntimeException("file name '" + this.name + + "' is too long ( > " + + NAMELEN + " bytes)"); + } } /**