Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
54f8d815
Commit
54f8d815
authored
Mar 22, 2015
by
Hisham Muhammad
Browse files
Do not trust isalpha(c) for values > 255.
Fixes #174. Conflicts: Panel.c
parent
ade7993f
Changes
7
Show whitespace changes
Inline
Side-by-side
AvailableColumnsPanel.c
View file @
54f8d815
...
...
@@ -54,7 +54,7 @@ static HandlerResult AvailableColumnsPanel_eventHandler(Panel* super, int ch) {
}
default:
{
if
(
isalpha
(
ch
))
if
(
ch
<
255
&&
isalpha
(
ch
))
result
=
Panel_selectByTyping
(
super
,
ch
);
break
;
}
...
...
CategoriesPanel.c
View file @
54f8d815
...
...
@@ -97,7 +97,7 @@ static HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch) {
break
;
}
default:
if
(
isalpha
(
ch
))
if
(
ch
<
255
&&
isalpha
(
ch
))
result
=
Panel_selectByTyping
(
super
,
ch
);
if
(
result
==
BREAK_LOOP
)
result
=
IGNORED
;
...
...
ColumnsPanel.c
View file @
54f8d815
...
...
@@ -100,7 +100,7 @@ static HandlerResult ColumnsPanel_eventHandler(Panel* super, int ch) {
}
default:
{
if
(
isalpha
(
ch
))
if
(
ch
<
255
&&
isalpha
(
ch
))
result
=
Panel_selectByTyping
(
super
,
ch
);
if
(
result
==
BREAK_LOOP
)
result
=
IGNORED
;
...
...
IncSet.c
View file @
54f8d815
...
...
@@ -151,7 +151,7 @@ bool IncSet_handleKey(IncSet* this, int ch, Panel* panel, IncMode_GetPanelValue
}
}
doSearch
=
false
;
}
else
if
(
isprint
((
char
)
ch
)
&&
(
mode
->
index
<
INCMODE_MAX
))
{
}
else
if
(
ch
<
255
&&
isprint
((
char
)
ch
)
&&
(
mode
->
index
<
INCMODE_MAX
))
{
mode
->
buffer
[
mode
->
index
]
=
ch
;
mode
->
index
++
;
mode
->
buffer
[
mode
->
index
]
=
0
;
...
...
Panel.c
View file @
54f8d815
...
...
@@ -431,7 +431,7 @@ HandlerResult Panel_selectByTyping(Panel* this, int ch) {
this
->
eventHandlerState
=
calloc
(
100
,
1
);
char
*
buffer
=
this
->
eventHandlerState
;
if
(
isalnum
(
ch
))
{
if
(
ch
<
255
&&
isalnum
(
ch
))
{
int
len
=
strlen
(
buffer
);
if
(
len
<
99
)
{
buffer
[
len
]
=
ch
;
...
...
RichString.c
View file @
54f8d815
...
...
@@ -128,7 +128,7 @@ static inline void RichString_writeFrom(RichString* this, int attrs, const char*
int
newLen
=
from
+
len
;
RichString_setLen
(
this
,
newLen
);
for
(
int
i
=
from
,
j
=
0
;
i
<
newLen
;
i
++
,
j
++
)
this
->
chptr
[
i
]
=
(
isprint
(
data_c
[
j
]
)
?
data_c
[
j
]
:
'?'
)
|
attrs
;
this
->
chptr
[
i
]
=
(
data_c
[
j
]
>=
32
?
data_c
[
j
]
:
'?'
)
|
attrs
;
this
->
chptr
[
newLen
]
=
0
;
}
...
...
htop.c
View file @
54f8d815
...
...
@@ -381,7 +381,7 @@ int main(int argc, char** argv) {
continue;
}
if (isdigit((char)ch)) {
if (
ch < 255 &&
isdigit((char)ch)) {
if (Panel_size(panel) == 0) continue;
pid_t pid = ch-48 + acc;
for (int i = 0; i < ProcessList_size(pl); i++) {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment