Fix cast-after-dereference

Original code was dereferencing a char*, then casting the value
to size_t.  Should cast the pointer to size_t* then deference.
This commit is contained in:
DJ Delorie 2017-07-19 13:14:34 -04:00
parent 4f329ea996
commit f8cef4d07d
2 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2017-07-19 DJ Delorie <dj@delorie.com>
* grp/grp-merge.c (libc_hidden_def): Fix cast-after-dereference.
2017-07-19 H.J. Lu <hongjiu.lu@intel.com>
[BZ #21741]

View File

@ -137,7 +137,7 @@ __merge_grp (struct group *savedgrp, char *savedbuf, char *savedend,
/* Get the count of group members from the last sizeof (size_t) bytes in the
mergegrp buffer. */
savedmemcount = (size_t) *(savedend - sizeof (size_t));
savedmemcount = *(size_t *) (savedend - sizeof (size_t));
/* Get the count of new members to add. */
for (memcount = 0; mergegrp->gr_mem[memcount]; memcount++)