From: Benjamin Kaduk Date: Wed, 17 Sep 2014 16:07:02 +0000 (-0400) Subject: Fix disk name initialization in scout X-Git-Tag: upstream/1.6.17^2~43 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=3ce1880c08663e07e0b2817c83c011ca7c250bf2;p=packages%2Fo%2Fopenafs.git Fix disk name initialization in scout Scout needs to initialize names in scout_disk structures to prevent the use of uninitialized data. However, '\0' is a NUL character constant, i.e., the integer value 0, which is interpreted as NULL (the pointer constant) in a pointer context, such as when assigned to a variable of type char*. Since the name field in these structs is passed to printing routines, the safe initialization value is the empty string constant "", not a zero value. Reviewed-on: http://gerrit.openafs.org/11469 Tested-by: BuildBot Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Perry Ruiter Reviewed-by: Jeffrey Altman (cherry picked from commit 57ca77786eb6c04519f9358f1456fdf5b8006757) Change-Id: I970e19c698cc26255cd244671908a631ef959c30 Reviewed-on: http://gerrit.openafs.org/12078 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Reviewed-by: Stephan Wiesand --- diff --git a/src/scout/scout.c b/src/scout/scout.c index 2c2b392bf..f087cbdbe 100644 --- a/src/scout/scout.c +++ b/src/scout/scout.c @@ -407,7 +407,7 @@ scout_initDiskLightObjects(struct mini_line *a_line, struct gwin *a_win) curr_disk->prev = i - 1; curr_disk->next = i + 1; curr_disk->active = 0; - curr_disk->name = '\0'; + curr_disk->name = ""; /* * Bump up to the next disk structure.