diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-10-06 13:25:04 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-06-28 09:54:05 -0400 |
commit | d4285f03df475dccf2a7132e2a8808715f383c24 (patch) | |
tree | b13186c40bb616570de30df6cc8f507251888726 /src/or | |
parent | e12eba55b27ec3ecf0dac586f1eb3adc4b373ca0 (diff) | |
download | tor-d4285f03df475dccf2a7132e2a8808715f383c24.tar tor-d4285f03df475dccf2a7132e2a8808715f383c24.tar.gz |
Extend tor_sscanf so it can replace sscanf in rephist.c
Fixes bug 4195 and Coverity CID 448
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/rephist.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c index 720d14cf4..fa02f981f 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -1136,7 +1136,7 @@ rep_hist_load_mtbf_data(time_t now) wfu_timebuf[0] = '\0'; if (format == 1) { - n = sscanf(line, "%40s %ld %lf S=%10s %8s", + n = tor_sscanf(line, "%40s %ld %lf S=%10s %8s", hexbuf, &wrl, &trw, mtbf_timebuf, mtbf_timebuf+11); if (n != 3 && n != 5) { log_warn(LD_HIST, "Couldn't scan line %s", escaped(line)); @@ -1153,7 +1153,7 @@ rep_hist_load_mtbf_data(time_t now) wfu_idx = find_next_with(lines, i+1, "+WFU "); if (mtbf_idx >= 0) { const char *mtbfline = smartlist_get(lines, mtbf_idx); - n = sscanf(mtbfline, "+MTBF %lu %lf S=%10s %8s", + n = tor_sscanf(mtbfline, "+MTBF %lu %lf S=%10s %8s", &wrl, &trw, mtbf_timebuf, mtbf_timebuf+11); if (n == 2 || n == 4) { have_mtbf = 1; @@ -1164,7 +1164,7 @@ rep_hist_load_mtbf_data(time_t now) } if (wfu_idx >= 0) { const char *wfuline = smartlist_get(lines, wfu_idx); - n = sscanf(wfuline, "+WFU %lu %lu S=%10s %8s", + n = tor_sscanf(wfuline, "+WFU %lu %lu S=%10s %8s", &wt_uptime, &total_wt_time, wfu_timebuf, wfu_timebuf+11); if (n == 2 || n == 4) { |