From db60ebe9d8b2362845992c5b02aa9df8c19ff1f2 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Wed, 8 Jan 2025 19:04:34 +0100 Subject: [PATCH] network: Fix DataRate parser to allow whitespace between value and unit (as claimed) --- src/network/utils/data-rate.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/utils/data-rate.cc b/src/network/utils/data-rate.cc index 91b7d0ded..53eb5696c 100644 --- a/src/network/utils/data-rate.cc +++ b/src/network/utils/data-rate.cc @@ -24,7 +24,7 @@ bool DataRate::DoParse(const std::string s, uint64_t* v) { NS_LOG_FUNCTION(s << v); - std::string::size_type n = s.find_first_not_of("0123456789."); + std::string::size_type n = s.find_first_not_of("0123456789. "); if (n != std::string::npos) { // Found non-numeric std::istringstream iss; @@ -260,7 +260,7 @@ std::istream& operator>>(std::istream& is, DataRate& rate) { std::string value; - is >> value; + std::getline(is, value); uint64_t v; bool ok = DataRate::DoParse(value, &v); if (!ok)