diff --git a/src/setup_payload/QRCodeSetupPayloadParser.cpp b/src/setup_payload/QRCodeSetupPayloadParser.cpp index 150662675f9405..0eb88be7c9d2ab 100644 --- a/src/setup_payload/QRCodeSetupPayloadParser.cpp +++ b/src/setup_payload/QRCodeSetupPayloadParser.cpp @@ -365,6 +365,11 @@ CHIP_ERROR QRCodeSetupPayloadParser::populatePayload(SetupPayload & outPayload) outPayload.setUpPINCode = static_cast(dest); ReturnErrorOnFailure(readBits(buf, indexToReadFrom, dest, kPaddingFieldLengthInBits)); + if (dest != 0) + { + ChipLogError(SetupPayload, "Payload padding bits are not all 0: 0x%x", static_cast(dest)); + return CHIP_ERROR_INVALID_ARGUMENT; + } return populateTLV(outPayload, buf, indexToReadFrom); }