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)"); + } } /**