]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/util.c
BUG: don't try to fix things that ain't broken.. or not. My try for a fix ended...
[proxmark3-svn] / armsrc / util.c
index 8ff5b68d560669b4070e316d733c2957293a3d00..b1ef6ea084c57e855922a9ca214bfc2fe5b949bf 100644 (file)
@@ -85,6 +85,15 @@ int32_t le24toh (uint8_t data[3])
     return (data[2] << 16) | (data[1] << 8) | data[0];
 }
 
+//added here for parity calulations
+uint8_t oddparity(uint8_t bt)
+{
+   uint16_t v = bt;
+   v ^= v >> 4;
+   v &= 0xF;
+   return ((0x9669 >> v) & 1);
+}
+
 void LEDsoff()
 {
        LED_A_OFF();
@@ -265,7 +274,7 @@ void FormatVersionInformation(char *dst, int len, const char *prefix, void *vers
 {
        struct version_information *v = (struct version_information*)version_information;
        dst[0] = 0;
-       strncat(dst, prefix, len);
+       strncat(dst, prefix, len-1);
        if(v->magic != VERSION_INFORMATION_MAGIC) {
                strncat(dst, "Missing/Invalid version information", len - strlen(dst) - 1);
                return;
Impressum, Datenschutz