This is an automated email from the ASF dual-hosted git repository.

mlaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git


The following commit(s) were added to refs/heads/master by this push:
     new ef7351f  Fix mcumgr log level_list hang problem.
     new 7253b87  Merge pull request #49 from mlaz/mcumgr_fixes
ef7351f is described below

commit ef7351f644df1b06fb2ea010c8b22377f58a3d75
Author: Miguel Azevedo <miguella...@gmail.com>
AuthorDate: Tue Nov 19 19:24:01 2019 +0000

    Fix mcumgr log level_list hang problem.
---
 cmd/log_mgmt/port/mynewt/src/mynewt_log_mgmt.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cmd/log_mgmt/port/mynewt/src/mynewt_log_mgmt.c 
b/cmd/log_mgmt/port/mynewt/src/mynewt_log_mgmt.c
index edff9a0..33dd774 100644
--- a/cmd/log_mgmt/port/mynewt/src/mynewt_log_mgmt.c
+++ b/cmd/log_mgmt/port/mynewt/src/mynewt_log_mgmt.c
@@ -132,8 +132,12 @@ log_mgmt_impl_get_level(int idx, const char 
**out_level_name)
 {
     const char *name;
 
+    if (idx >= LOG_LEVEL_MAX) {
+        return LOG_MGMT_ERR_ENOENT;
+    }
+
     name = LOG_LEVEL_STR(idx);
-    if (name == NULL) {
+    if (!strcmp(name, "UNKNOWN")) {
         return LOG_MGMT_ERR_ENOENT;
     } else {
         *out_level_name = name;

Reply via email to