From f5a21050aa00c760f20bd3bdc6a4a4a256775c4f Mon Sep 17 00:00:00 2001 From: deimos Date: Thu, 28 Dec 2023 21:09:17 -0600 Subject: [PATCH] fix: add support for symbols --- examples/NDEFSendMessage/NDEFSendMessage.ino | 2 +- src/NdefRecord.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/NDEFSendMessage/NDEFSendMessage.ino b/examples/NDEFSendMessage/NDEFSendMessage.ino index 8ab3b9a..91f9466 100644 --- a/examples/NDEFSendMessage/NDEFSendMessage.ino +++ b/examples/NDEFSendMessage/NDEFSendMessage.ino @@ -44,7 +44,7 @@ void setup() { String encryptionType = "AES"; String password = "Password"; message.addWiFiRecord(ssid, authentificationType, encryptionType, password); - // message.addUriRecord("mailto:deimoshallgmail.com"); // TODO: check @ problem + message.addUriRecord("mailto:deimoshall@gmail.com"); nfc.setSendMsgCallback(messageSentCallback); Serial.println("Initializing..."); diff --git a/src/NdefRecord.cpp b/src/NdefRecord.cpp index 59f4f8a..cac3994 100644 --- a/src/NdefRecord.cpp +++ b/src/NdefRecord.cpp @@ -259,10 +259,11 @@ void NdefRecord::setPayload(String payload) { #endif this->payload = new unsigned char[payload.length()]; - strcpy((char *)this->payload, payload.c_str()); + strncpy((char *)this->payload, payload.c_str(), payload.length()); #ifdef DEBUG3 - // Serial.println("Payload: '" + getHexRepresentation(this->payload, length) + "'"); + Serial.println("Payload length: " + String(length)); + Serial.println("Payload: '" + getHexRepresentation(this->payload, length) + "'"); #endif }