glusterd: Fix Buffer size issues
This patch fixes buffer size issue 1138522. Change-Id: Ia12fc8f34f75704f8ed3efae2022c4fd67a8c76c updates: bz#789278 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
This commit is contained in:
parent
13298d2b38
commit
8612a1ca19
@ -277,7 +277,7 @@ typedef enum {
|
||||
struct gf_gsync_detailed_status_ {
|
||||
char node[NAME_MAX];
|
||||
char master[NAME_MAX];
|
||||
char brick[NAME_MAX];
|
||||
char brick[PATH_MAX];
|
||||
char slave_user[NAME_MAX];
|
||||
char slave[NAME_MAX];
|
||||
char slave_node[NAME_MAX];
|
||||
@ -369,9 +369,9 @@ typedef enum gf_getspec_flags_type gf_getspec_flags_type;
|
||||
#define GD_MGMT_HNDSK_PROGRAM 1239873 /* Completely random */
|
||||
#define GD_MGMT_HNDSK_VERSION 1
|
||||
|
||||
#define GD_VOLUME_NAME_MAX 256 /* Maximum size of volume name */
|
||||
#define GD_VOLUME_NAME_MAX_TIER (GD_VOLUME_NAME_MAX + 5) /*+5 needed for '-hot
|
||||
and '-cold' suffixes*/
|
||||
#define GD_VOLUME_NAME_MAX ((NAME_MAX + 1) - 5) /* Maximum size of volume name */
|
||||
#define GD_VOLUME_NAME_MAX_TIER (GD_VOLUME_NAME_MAX + 5) /* +5 needed for '-hot'
|
||||
and '-cold' suffixes*/
|
||||
|
||||
#define GLUSTER_PROCESS_UUID_FMT "CTX_ID:%s-GRAPH_ID:%d-PID:%d-HOST:%s-PC_NAME:%s-RECON_NO:%s"
|
||||
#endif /* !_PROTOCOL_COMMON_H */
|
||||
|
@ -6403,11 +6403,11 @@ afr_get_split_brain_status (void *opaque)
|
||||
/* Calculation for string length :
|
||||
* (child_count X length of child-name) + strlen (" Choices :")
|
||||
* child-name consists of :
|
||||
* a) 256 = max characters for volname according to GD_VOLUME_NAME_MAX
|
||||
* a) 251 = max characters for volname according to GD_VOLUME_NAME_MAX
|
||||
* b) strlen ("-client-00,") assuming 16 replicas
|
||||
*/
|
||||
choices = alloca0 (priv->child_count * (256 + strlen ("-client-00,")) +
|
||||
strlen (" Choices:"));
|
||||
choices = alloca0 (priv->child_count * (251 + sizeof("-client-00,")) +
|
||||
sizeof(" Choices:"));
|
||||
|
||||
ret = afr_is_split_brain (frame, this, inode, loc->gfid, &d_spb,
|
||||
&m_spb);
|
||||
|
@ -221,7 +221,7 @@ typedef enum gf_brick_status {
|
||||
} gf_brick_status_t;
|
||||
|
||||
struct glusterd_brickinfo {
|
||||
char hostname[1024];
|
||||
char hostname[NAME_MAX];
|
||||
char path[VALID_GLUSTERD_PATHMAX];
|
||||
char real_path[VALID_GLUSTERD_PATHMAX];
|
||||
char device_path[VALID_GLUSTERD_PATHMAX];
|
||||
@ -407,12 +407,15 @@ struct glusterd_volinfo_ {
|
||||
the volume which is snapped. In
|
||||
case of a non-snap volume, this
|
||||
field will be initialized as N/A */
|
||||
char volname[GD_VOLUME_NAME_MAX + 5];
|
||||
/* An extra 5 bytes are allocated.
|
||||
* Reason is, As part of the tiering
|
||||
char volname[NAME_MAX + 1];
|
||||
/* NAME_MAX + 1 will be equal to
|
||||
* GD_VOLUME_NAME_MAX + 5.(also to
|
||||
* GD_VOLUME_NAME_MAX_TIER). An extra 5
|
||||
* bytes are added to GD_VOLUME_NAME_MAX
|
||||
* because, as part of the tiering
|
||||
* volfile generation code, we are
|
||||
* temporarily appending either hot
|
||||
* or cold */
|
||||
* temporarily appending either "-hot"
|
||||
* or "-cold" */
|
||||
int type;
|
||||
int brick_count;
|
||||
uint64_t snap_count;
|
||||
|
Loading…
x
Reference in New Issue
Block a user