Skip to content

Commit

Permalink
bugfix in trimWhitespace (was over-trimming 1-char strings with leadi…
Browse files Browse the repository at this point in the history
…ng whitespace)
  • Loading branch information
sflow committed May 30, 2023
1 parent bd697f4 commit a67c314
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hsflowd.spec
@@ -1,7 +1,7 @@
Summary: host sFlow daemon
Name: hsflowd
Version: 2.0.51
Release: 17
Release: 18
License: http://sflow.net/license.html
Group: Applications/Internet
URL: http://sflow.net
Expand Down
3 changes: 3 additions & 0 deletions src/Linux/readNioCounters.c
Expand Up @@ -65,6 +65,9 @@ extern "C" {
if(sscanf(line, "%[^:]:%[^\n]", buf_var, buf_val) == 2) {
char *tok_var = trimWhitespace(buf_var, my_strnlen(buf_var, MAX_PROC_LINE_CHARS-1));
char *tok_val = trimWhitespace(buf_val, my_strnlen(buf_val, MAX_PROC_LINE_CHARS-1));
if(tok_var == NULL
|| tok_val == NULL)
continue;

if(readingMaster) {
if(my_strequal(tok_var, "MII Status")) {
Expand Down
2 changes: 1 addition & 1 deletion src/Linux/util.c
Expand Up @@ -554,7 +554,7 @@ extern "C" {
while(isspace(*str)) {
// also return NULL for a string with only spaces in it
// (don't want that condition to slip through unnoticed)
if(++str >= end)
if(++str > end)
return NULL;
}

Expand Down

0 comments on commit a67c314

Please sign in to comment.