]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix the label search routine in geom_map to not trip up on '\0' bytes.
authorAdrian Chadd <adrian@FreeBSD.org>
Thu, 19 Mar 2015 03:58:25 +0000 (03:58 +0000)
committerAdrian Chadd <adrian@FreeBSD.org>
Thu, 19 Mar 2015 03:58:25 +0000 (03:58 +0000)
commit28d507fcec396d3a6eb1b15bf345b690e1d88e43
tree1e59d75c27aeb8c0dfce05fe50313cb9abda45ea
parentdfdf9abd948b59acbe26a3521aee7cce77379908
Fix the label search routine in geom_map to not trip up on '\0' bytes.

* Just do the buf check early and fail out
* If the offset being searched is:

00110000  00 b5 7e 45 61 e2 76 d3  c1 78 dd 15 95 cd 1f f1  |..~Ea.v..x......|

.. and the match string is '.!/bin/sh'

.. then it'll set the match string[0] to '\0', do a strncmp() against
the read buffer, find it's matching two zero-length strings, and think
that's where to start.

MFC after: 2 weeks
sys/geom/geom_map.c