mirror of https://github.com/acidanthera/audk.git
MdePkg/UefiDevicePathLib: Add sanity check for FilePath device path
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1497 Current implementation of IsDevicePathValid() is not enough for type of MEDIA_FILEPATH_DP, which has NULL-terminated string in the device path. This patch add a simple NULL character check at Length position. Cc: Liming Gao <liming.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
parent
b6f67b4d58
commit
2f7a96d6ec
|
@ -95,6 +95,15 @@ IsDevicePathValid (
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// FilePath must be a NULL-terminated string.
|
||||||
|
//
|
||||||
|
if (DevicePathType (DevicePath) == MEDIA_DEVICE_PATH &&
|
||||||
|
DevicePathSubType (DevicePath) == MEDIA_FILEPATH_DP &&
|
||||||
|
*(CHAR16 *)((UINT8 *)DevicePath + NodeLength - 2) != 0) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue