summary refs log tree commit diff
path: root/nix/libstore/build.cc
diff options
context:
space:
mode:
Diffstat (limited to 'nix/libstore/build.cc')
-rw-r--r--nix/libstore/build.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 5697ae5a43..f6431bb726 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -3102,7 +3102,8 @@ void SubstitutionGoal::finished()
 		throw Error(format("unknown hash algorithm in `%1%'") % hashStr);
 	    case htSHA256:
 		hash.first = parseHash16or32(hashType, string(hashStr, n + 1));
-		hash.second = std::atoi(statusList[2].c_str());
+		if (!string2Int(statusList[2], hash.second))
+		    throw Error(format("invalid nar size for '%1%' substitute") % storePath);
 		break;
 	    default:
 		/* The database only stores SHA256 hashes, so compute it.  */