From 86053beac56629f7bdbc2695fda560e0410e430f Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Sat, 2 Mar 2013 09:19:13 +0000 Subject: [PATCH 1/1] Unix CM: Make rootVolume array big enough In afs_CheckRootVolume, the local rootVolumeName array needs to be large enough to hold the contents of the global afs_rootVolumeName string, which is 64 characters long. Fix our local array to be the same length by using a new defined constant MAXROOTVOLNAMELEN. Caught by coverity (#985758) Change-Id: I4c926b94efb40d7107e2d7160ade0ba8b381004e Reviewed-on: http://gerrit.openafs.org/9348 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- src/afs/afs.h | 1 + src/afs/afs_daemons.c | 2 +- src/afs/afs_prototypes.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/afs/afs.h b/src/afs/afs.h index 63fb03d..443bd0b 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -88,6 +88,7 @@ extern int afs_shuttingdown; #define MAXVOLS 128 /* max vols we can store */ #define MAXSYSNAME 128 /* max sysname (i.e. @sys) size */ #define MAXNUMSYSNAMES 32 /* max that current constants allow */ +#define MAXROOTVOLNAMELEN 64 /* max length of root volume name */ #define NOTOKTIMEOUT (2*3600) /* time after which to timeout conns sans tokens */ #define NOPAG 0xffffffff diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c index dd943a7..b283f77 100644 --- a/src/afs/afs_daemons.c +++ b/src/afs/afs_daemons.c @@ -306,7 +306,7 @@ afs_Daemon(void) int afs_CheckRootVolume(void) { - char rootVolName[32]; + char rootVolName[MAXROOTVOLNAMELEN]; struct volume *tvp = NULL; int usingDynroot = afs_GetDynrootEnable(); int localcell; diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index 636151e..b6eb2df 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -30,7 +30,7 @@ extern void shutdown_bufferpackage(void); /* afs_call.c */ extern int afs_cold_shutdown; -extern char afs_rootVolumeName[64]; +extern char afs_rootVolumeName[MAXROOTVOLNAMELEN]; extern void afs_shutdown(void); extern void afs_FlushCBs(void); extern int afs_CheckInit(void); -- 1.9.4