diff options
Diffstat (limited to 'opentracker.c')
| -rw-r--r-- | opentracker.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/opentracker.c b/opentracker.c index 4d44950..f218589 100644 --- a/opentracker.c +++ b/opentracker.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | 28 | ||
| 29 | /* Opentracker */ | 29 | /* Opentracker */ |
| 30 | #include "ot_accesslist.h" | 30 | #include "ot_accesslist.h" |
| 31 | #include "ot_hex.h" | ||
| 31 | #include "ot_http.h" | 32 | #include "ot_http.h" |
| 32 | #include "ot_livesync.h" | 33 | #include "ot_livesync.h" |
| 33 | #include "ot_mutex.h" | 34 | #include "ot_mutex.h" |
| @@ -646,16 +647,10 @@ void load_state(const char *const state_filename) { | |||
| 646 | /* We do ignore anything that is not of the form "^[:xdigit:]:\d+:\d+" */ | 647 | /* We do ignore anything that is not of the form "^[:xdigit:]:\d+:\d+" */ |
| 647 | while (fgets(inbuf, sizeof(inbuf), state_filehandle)) { | 648 | while (fgets(inbuf, sizeof(inbuf), state_filehandle)) { |
| 648 | size_t i; | 649 | size_t i; |
| 649 | for (i = 0; i < sizeof(ot_hash); ++i) { | ||
| 650 | int eger = 16 * scan_fromhex(inbuf[2 * i]) + scan_fromhex(inbuf[1 + 2 * i]); | ||
| 651 | if (eger < 0) | ||
| 652 | continue; | ||
| 653 | infohash[i] = eger; | ||
| 654 | } | ||
| 655 | 650 | ||
| 656 | if (i != sizeof(ot_hash)) | 651 | if (!hex_tohash(infohash, inbuf)) |
| 657 | continue; | 652 | continue; |
| 658 | i *= 2; | 653 | i = 2 * sizeof(ot_hash); |
| 659 | 654 | ||
| 660 | if (inbuf[i++] != ':' || !(consumed = scan_ulonglong(inbuf + i, &base))) | 655 | if (inbuf[i++] != ':' || !(consumed = scan_ulonglong(inbuf + i, &base))) |
| 661 | continue; | 656 | continue; |
