]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/util.c
CHG: moved a xor function into util.c
[proxmark3-svn] / armsrc / util.c
index 8ff5b68d560669b4070e316d733c2957293a3d00..74fba94b764db748cf6a377ba23b96f5d06bc304 100644 (file)
@@ -8,10 +8,11 @@
 // Utility functions used in many places, not specific to any piece of code.
 //-----------------------------------------------------------------------------
 
-#include "../include/proxmark3.h"
+#include "proxmark3.h"
 #include "util.h"
 #include "string.h"
 #include "apps.h"
+#include "BigBuf.h"
 
 
 
@@ -34,7 +35,7 @@ void print_result(char *name, uint8_t *buf, size_t len) {
 }
 
 size_t nbytes(size_t nbits) {
-       return (nbits/8)+((nbits%8)>0);
+       return (nbits >> 3)+((nbits % 8) > 0);
 }
 
 uint32_t SwapBits(uint32_t value, int nrbits) {
@@ -265,7 +266,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;
@@ -428,4 +429,3 @@ uint32_t RAMFUNC GetCountSspClk(){
        }
 }
 
-
Impressum, Datenschutz