Subversion Repositories libtar

Compare Revisions

Ignore whitespace Rev 35 → Rev 36

/trunk/debian/patches/no_maxpathlen.patch
88,6 → 88,31
/* Empty or NULL string gets treated as "." */
if (path == NULL || *path == '\0') {
@@ -67,11 +79,19 @@ openbsd_dirname(path)
} while (endp > path && *endp == '/');
}
- if (endp - path + 1 > sizeof(bname)) {
- errno = ENAMETOOLONG;
- return(NULL);
+ len = endp - path + 1;
+
+ if (len + 1 > allocated) {
+ size_t new_allocated = 2*(len+1);
+ void *new_bname = malloc(new_allocated);
+ if (!new_bname)
+ return NULL;
+ allocated = new_allocated;
+ free(bname);
+ bname = new_bname;
}
- (void)strncpy(bname, path, endp - path + 1);
- bname[endp - path + 1] = '\0';
+
+ (void)strncpy(bname, path, len);
+ bname[len] = '\0';
return(bname);
}
--- a/lib/append.c
+++ b/lib/append.c
@@ -38,7 +38,7 @@ typedef struct tar_dev tar_dev_t;