]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/util.c
FIX: Coverity, out-of-bounds write, CID#121340, CID#121341, CID#121342, CID#121343...
[proxmark3-svn] / armsrc / util.c
index 1dd8dc7544fe1cb2989548692f8449f19b6ca621..4fffb60e24b089d8c556a919c702cdeef7662c77 100644 (file)
@@ -74,6 +74,7 @@ void rol(uint8_t *data, const size_t len){
     }
     data[len-1] = first;
 }
+
 void lsl (uint8_t *data, size_t len) {
     for (size_t n = 0; n < len - 1; n++) {
         data[n] = (data[n] << 1) | (data[n+1] >> 7);
@@ -345,7 +346,9 @@ void StartCountUS()
        }
 
 uint32_t RAMFUNC GetCountUS(){
-       return (AT91C_BASE_TC1->TC_CV * 0x8000) + ((AT91C_BASE_TC0->TC_CV / 15) * 10);
+       //return (AT91C_BASE_TC1->TC_CV * 0x8000) + ((AT91C_BASE_TC0->TC_CV / 15) * 10);
+       //  By suggestion from PwPiwi, http://www.proxmark.org/forum/viewtopic.php?pid=17548#p17548
+       return (AT91C_BASE_TC1->TC_CV * 0x8000) + ((AT91C_BASE_TC0->TC_CV * 2) / 3); 
 }
 
 static uint32_t GlobalUsCounter = 0;
@@ -419,7 +422,6 @@ void StartCountSspClk()
        while (AT91C_BASE_TC0->TC_CV < 0xFFF0);
 }
 
-
 uint32_t RAMFUNC GetCountSspClk(){
        uint32_t tmp_count;
        tmp_count = (AT91C_BASE_TC2->TC_CV << 16) | AT91C_BASE_TC0->TC_CV;
Impressum, Datenschutz