OCRepresentation: fix segmentation fault by initializing memory
authorHauke Mehrtens <hauke.mehrtens@lantiq.com>
Wed, 26 Aug 2015 13:36:58 +0000 (15:36 +0200)
committerJon A. Cruz <jonc@osg.samsung.com>
Thu, 27 Aug 2015 19:11:35 +0000 (19:11 +0000)
commit0f8b4c4ca03e7d39675901f117f5d79a5daeeeae
treedd279a1de541f97eaf9994e96b62c48aa9d28e25
parentb9a7f86f3937e5fbe489f1afde0369eeb72079ec
OCRepresentation: fix segmentation fault by initializing memory

dimensions was not fully initialized, but used by the code, so it could
contain arbitrary memory. If this memory was a big number this code
could allocate very much memory as this was used to create a 2 or 3
dimensional arrays.

This fixes a Segmentation fault seen in normal operation of the
garageserver and a invalid memory read and a following segmentation
fault seen with valgrind in the garageserver

Change-Id: Ifbab3d48b00bd2e3559ca3a8d79336ecf5feef6e
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2285
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
resource/src/OCRepresentation.cpp