From bcb79e66ab1a5ed1273264540ea6d571196b7ec2 Mon Sep 17 00:00:00 2001 From: Shane Loretz Date: Fri, 4 Oct 2019 15:12:45 -0700 Subject: [PATCH] Fix off by one bug (#2) Signed-off-by: Shane Loretz Signed-off-by: Shane Loretz --- src/detector_network.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/detector_network.cpp b/src/detector_network.cpp index f1a25e49..6a9121ca 100644 --- a/src/detector_network.cpp +++ b/src/detector_network.cpp @@ -68,8 +68,8 @@ DetectorNetwork::DetectorNetwork( // Make copies because of darknet's lack of const std::unique_ptr config_mutable(new char[config_file.size() + 1]); std::unique_ptr weights_mutable(new char[weights_file.size() + 1]); - snprintf(&*config_mutable, config_file.size(), "%s", config_file.c_str()); - snprintf(&*weights_mutable, config_file.size(), "%s", weights_file.c_str()); + snprintf(&*config_mutable, config_file.size() + 1, "%s", config_file.c_str()); + snprintf(&*weights_mutable, config_file.size() + 1, "%s", weights_file.c_str()); const int clear = 0; impl_->network_ = load_network(&*config_mutable, &*weights_mutable, clear);