]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sourcestats: fix signedness in scanf format
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 19 Mar 2014 16:08:52 +0000 (17:08 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 21 Mar 2014 12:20:24 +0000 (13:20 +0100)
sourcestats.c

index 643fe28e36abaa91f492086314466ce433ad1fb0..f3e5d421338e6e030c1f4bc5060648c5e95f91b6 100644 (file)
@@ -771,7 +771,8 @@ SST_LoadFromFile(SST_Stats inst, FILE *in)
   double weight;
 
   if (fgets(line, sizeof(line), in) &&
-      (sscanf(line, "%u", &inst->n_samples) == 1) && inst->n_samples <= MAX_SAMPLES) {
+      sscanf(line, "%d", &inst->n_samples) == 1 &&
+      inst->n_samples > 0 && inst->n_samples <= MAX_SAMPLES) {
 
     line_number = 2;