Unverified Commit b4a9bd85 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

fix: Validate serial number (#729)

parent 0f8be481
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -20,8 +20,11 @@ MAC_OPTS="-machine type=${MACHINE},smm=${SECURE},graphics=off,vmport=${VMPORT},d

if [ -s "/sys/class/dmi/id/product_serial" ]; then
  BIOS_SERIAL=$(</sys/class/dmi/id/product_serial)
  BIOS_SERIAL="${BIOS_SERIAL//[![:alnum:]]/}"
  if [ -n "$BIOS_SERIAL" ]; then
    MAC_OPTS+=" -smbios type=1,serial=$BIOS_SERIAL"
  fi
fi

if [[ "${MACHINE,,}" != "pc-i440fx-2"* ]]; then
  DEV_OPTS="-object rng-random,id=objrng0,filename=/dev/urandom"