diff --git a/lib/isc/unix/dir.c b/lib/isc/unix/dir.c index f127ed0ef2..e4b6a47fc7 100644 --- a/lib/isc/unix/dir.c +++ b/lib/isc/unix/dir.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: dir.c,v 1.3 1999/09/28 03:37:36 tale Exp $ */ +/* $Id: dir.c,v 1.4 1999/10/01 01:12:04 tale Exp $ */ /* Principal Authors: DCL */ @@ -93,7 +93,8 @@ isc_dir_read(isc_dir_t *dir) { /* * Make sure that the space for the name is long enough. */ - INSIST(sizeof(dir->entry.name) > strlen(entry->d_name)); + if (sizeof(dir->entry.name) <= strlen(entry->d_name)) + return (ISC_R_UNEXPECTED); strcpy(dir->entry.name, entry->d_name); diff --git a/lib/isc/unix/include/isc/dir.h b/lib/isc/unix/include/isc/dir.h index 4017337c0a..691e7f761d 100644 --- a/lib/isc/unix/include/isc/dir.h +++ b/lib/isc/unix/include/isc/dir.h @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: dir.h,v 1.1 1999/09/23 17:31:59 tale Exp $ */ +/* $Id: dir.h,v 1.2 1999/10/01 01:12:04 tale Exp $ */ /* Principal Authors: DCL */ @@ -32,13 +32,23 @@ ISC_LANG_BEGINDECLS typedef struct { - char name[NAME_MAX]; + /* + * Ideally, this should be NAME_MAX, but AIX does not define it by + * default and dynamically allocating the space based on pathconf() + * complicates things undesirably, as does adding special conditionals + * just for AIX. So a comfortably sized buffer is chosen instead. + */ + char name[256]; unsigned int length; } isc_direntry_t; typedef struct { int magic; - char dirname[PATH_MAX]; + /* + * As with isc_direntry_t->name, making this "right" for all systems + * is slightly problematic because AIX does not define PATH_MAX. + */ + char dirname[1024]; isc_direntry_t entry; DIR * handle; } isc_dir_t;