fixed using strtod() by resetting errno to detect overflow/underflow
[rocksndiamonds.git] / src / game_bd / bd_bdcff.c
index 8f2ee081e54ffc646a9008e1c3c690820d5d6b37..4c57c14e52988c3ce9c89d040c13aa4a7c74e297 100644 (file)
@@ -254,6 +254,7 @@ static boolean struct_set_property(gpointer str, const GdStructDescriptor *prop_
            break;
 
          case GD_TYPE_PROBABILITY:
+           errno = 0;  /* must be reset before calling strtod() to detect overflow/underflow */
            res = strtod(params[paramindex], NULL);
            if (errno == 0 && res >= 0 && res <= 1)
            {
@@ -268,6 +269,7 @@ static boolean struct_set_property(gpointer str, const GdStructDescriptor *prop_
            break;
 
          case GD_TYPE_RATIO:
+           errno = 0;  /* must be reset before calling strtod() to detect overflow/underflow */
            res = strtod (params[paramindex], NULL);
            if (errno == 0 && res >= 0 && res <= 1)
            {