diff options
Diffstat (limited to 'ot_sync.c')
| -rw-r--r-- | ot_sync.c | 12 |
1 files changed, 6 insertions, 6 deletions
| @@ -12,11 +12,11 @@ | |||
| 12 | 12 | ||
| 13 | /* Libowfat */ | 13 | /* Libowfat */ |
| 14 | #include "io.h" | 14 | #include "io.h" |
| 15 | #include "scan.h" | ||
| 16 | 15 | ||
| 17 | /* Opentracker */ | 16 | /* Opentracker */ |
| 18 | #include "ot_iovec.h" | 17 | #include "ot_iovec.h" |
| 19 | #include "ot_mutex.h" | 18 | #include "ot_mutex.h" |
| 19 | #include "ot_scan.h" | ||
| 20 | #include "ot_stats.h" | 20 | #include "ot_stats.h" |
| 21 | #include "ot_sync.h" | 21 | #include "ot_sync.h" |
| 22 | #include "trackerlogic.h" | 22 | #include "trackerlogic.h" |
| @@ -30,9 +30,9 @@ | |||
| 30 | [..]: ( 20:01234567890abcdefghij16:XXXXYYYY )+ | 30 | [..]: ( 20:01234567890abcdefghij16:XXXXYYYY )+ |
| 31 | */ | 31 | */ |
| 32 | int add_changeset_to_tracker(uint8_t *data, size_t len) { | 32 | int add_changeset_to_tracker(uint8_t *data, size_t len) { |
| 33 | ot_hash *hash; | 33 | ot_hash *hash; |
| 34 | uint8_t *end = data + len; | 34 | uint8_t *end = data + len; |
| 35 | unsigned long peer_count; | 35 | uint64_t peer_count; |
| 36 | 36 | ||
| 37 | /* We do know, that the string is \n terminated, so it can't | 37 | /* We do know, that the string is \n terminated, so it can't |
| 38 | overflow */ | 38 | overflow */ |
| @@ -50,8 +50,8 @@ int add_changeset_to_tracker(uint8_t *data, size_t len) { | |||
| 50 | hash = (ot_hash *)data; | 50 | hash = (ot_hash *)data; |
| 51 | data += sizeof(ot_hash); | 51 | data += sizeof(ot_hash); |
| 52 | 52 | ||
| 53 | /* Scan string length indicator */ | 53 | /* Scan string length indicator, strictly: bencode writes no leading zeros */ |
| 54 | data += (len = scan_ulong((char *)data, &peer_count)); | 54 | data += (len = scan_udec_bencode((char *)data, &peer_count, (uint64_t)(end - data))); |
| 55 | 55 | ||
| 56 | /* If no long was scanned, it is not divisible by 8, it is not | 56 | /* If no long was scanned, it is not divisible by 8, it is not |
| 57 | followed by a colon or claims to need to much memory, we fail */ | 57 | followed by a colon or claims to need to much memory, we fail */ |
