summaryrefslogtreecommitdiffstats
path: root/htop.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-01-05 14:45:12 +0100
committerBenBE <BenBE@geshi.org>2021-01-11 20:12:34 +0100
commit958112c5a396815da7a731f406dbfd27bf713572 (patch)
tree49b8640137ba6e70072d5ade0bc8260abc59dc8e /htop.c
parenta118928dee0874eef98be81531a98577c1ae3f7d (diff)
Refactor setting filter and use safe strncpy
Diffstat (limited to 'htop.c')
-rw-r--r--htop.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/htop.c b/htop.c
index 00ff1dab..a8935f40 100644
--- a/htop.c
+++ b/htop.c
@@ -248,13 +248,8 @@ static void setCommFilter(State* state, char** commFilter) {
MainPanel* panel = (MainPanel*)state->panel;
ProcessList* pl = state->pl;
IncSet* inc = panel->inc;
- size_t maxlen = sizeof(inc->modes[INC_FILTER].buffer) - 1;
- char* buffer = inc->modes[INC_FILTER].buffer;
- strncpy(buffer, *commFilter, maxlen);
- buffer[maxlen] = 0;
- inc->modes[INC_FILTER].index = strlen(buffer);
- inc->filtering = true;
+ IncSet_setFilter(inc, *commFilter);
pl->incFilter = IncSet_filter(inc);
free(*commFilter);

© 2014-2024 Faster IT GmbH | imprint | privacy policy