summaryrefslogtreecommitdiffstats
path: root/src/network/socket
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@theqtcompany.com>2016-05-30 15:25:06 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2016-05-31 11:37:01 +0000
commit28db26f6917174d787bd4c6eadbecebc952d59dc (patch)
tree6b614045a72dc3976ed6760fe04a5f00c5d449f5 /src/network/socket
parenteb50193136c7c73be864e3232d01e98ddc24e539 (diff)
qtestcase: Fix buffer over-run, '\0' appended beyond buffer end
Noticed by Coverity (CID 161673). If the file being read contains enough to fill the buffer, read() shall do that and return the nbytes it was passed; as this was the size of the buffer, subsequently writing a '\0' at this index in buffer is out of bounds. Fortunately, /proc/self/status is typically < 1k so fits well inside the 2k buffer. All the same, we can safely pass sizeof(buffer) - 1 as nbytes and *be sure* of not getting a buffer over-run. Change-Id: Ib620a330fbc94f0579c953737f7c4417ca449968 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Diffstat (limited to 'src/network/socket')
0 files changed, 0 insertions, 0 deletions