aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlogin (envs.net) <login@envs.net>2020-02-21 17:16:36 +0000
committerlogin (envs.net) <login@envs.net>2020-02-21 17:16:36 +0000
commitc6270c739d48af98725cb5b92d2e5fb5f91b07a2 (patch)
tree573c04a438db729955a05501f2b48c09eae1a926
parent3aa292ba349428f9672a158453f004bca72e6589 (diff)
downloadtcoin-c6270c739d48af98725cb5b92d2e5fb5f91b07a2.tar.gz
Replacing newlines and vertical tabs in messages with <new-line> and <vertical-tab>
Newlines and vertical tabs in messages are replaced with <new-line> and <vertical-tab> to prevent transaction spoofing inside a message.
-rwxr-xr-xntcoin4
-rw-r--r--pcoin.cpp4
-rw-r--r--tcoin.cpp4
3 files changed, 8 insertions, 4 deletions
diff --git a/ntcoin b/ntcoin
index 26cacc9..ce114a7 100755
--- a/ntcoin
+++ b/ntcoin
@@ -192,7 +192,7 @@ else
&& (/bin/cp "'`/usr/bin/realpath -s $1`'/tcoin/bin/tcoin" "'`/usr/bin/realpath -s $2`'/tcoin") \
&& (/bin/chmod 550 "'`/usr/bin/realpath -s $2`'/tcoin") \
&& (/bin/chmod u+s "'`/usr/bin/realpath -s $2`'/tcoin") \
-&& (/bin/cp "'`/usr/bin/realpath -s $1`'/tcoin/bin/tcoin_defs.cpp'" "'`/usr/bin/realpath -s $2`'/tcoin_defs.cpp'")' > "`/usr/bin/realpath -s $1`/tcoin/bin/compile_tcoin"
+&& (/bin/cp "'`/usr/bin/realpath -s $1`'/tcoin/bin/tcoin_defs.cpp" "'`/usr/bin/realpath -s $2`'/tcoin_defs.cpp")' > "`/usr/bin/realpath -s $1`/tcoin/bin/compile_tcoin"
/bin/chmod 540 "`/usr/bin/realpath -s $1`/tcoin/bin/compile_tcoin"
/bin/echo '#!/bin/bash
'`which nano`' "'`/bin/pwd`'/tcoin.cpp"' > "`/usr/bin/realpath -s $1`/tcoin/bin/edit_tcoin"
@@ -214,7 +214,7 @@ else
&& (/bin/cp "'`/usr/bin/realpath -s $1`'/tcoin/bin/pcoin" "'`/usr/bin/realpath -s $2`'/pcoin") \
&& (/bin/chmod 550 "'`/usr/bin/realpath -s $2`'/pcoin") \
&& (/bin/chmod u+s "'`/usr/bin/realpath -s $2`'/pcoin") \
-&& (/bin/cp "'`/usr/bin/realpath -s $1`'/tcoin/bin/pcoin_defs.cpp'" "'`/usr/bin/realpath -s $2`'/pcoin_defs.cpp'")' > "`/usr/bin/realpath -s $1`/tcoin/bin/compile_pcoin"
+&& (/bin/cp "'`/usr/bin/realpath -s $1`'/tcoin/bin/pcoin_defs.cpp" "'`/usr/bin/realpath -s $2`'/pcoin_defs.cpp")' > "`/usr/bin/realpath -s $1`/tcoin/bin/compile_pcoin"
/bin/chmod 540 "`/usr/bin/realpath -s $1`/tcoin/bin/compile_pcoin"
/bin/echo '#!/bin/bash
'`which nano`' "'`/bin/pwd`'/pcoin.cpp"' > "`/usr/bin/realpath -s $1`/tcoin/bin/edit_pcoin"
diff --git a/pcoin.cpp b/pcoin.cpp
index 337fc08..9e00b21 100644
--- a/pcoin.cpp
+++ b/pcoin.cpp
@@ -678,7 +678,9 @@ int send_message(const char* sender_username, const char* receiver_username, con
for(int i=0; message[i]!='\0'; ++i)
{
if(message[i] == '\n')
- fout << "\u23CE "; //return-key symbol, or return symbol, or enter symbol; space for spacing
+ fout << "<new-line>"; //return-key pressed
+ else if(message[i] == '\v')
+ fout << "<vertical-tab>"; //vertical-tab symbol entered
else
fout << message[i];
}
diff --git a/tcoin.cpp b/tcoin.cpp
index 163323a..f9abffb 100644
--- a/tcoin.cpp
+++ b/tcoin.cpp
@@ -961,7 +961,9 @@ int send_message(const char* sender_username, const char* receiver_username, con
for(int i=0; message[i]!='\0'; ++i)
{
if(message[i] == '\n')
- fout << "\u23CE "; //return-key symbol, or return symbol, or enter symbol; space for spacing
+ fout << "<new-line>"; //return-key pressed
+ else if(message[i] == '\v')
+ fout << "<vertical-tab>"; //vertical-tab symbol entered
else
fout << message[i];
}