Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ceddral
fahrradwurstmond
Commits
9f59ab99
Commit
9f59ab99
authored
Sep 20, 2021
by
ceddral
Browse files
telnet_gui/screen: fix screen size TOCTOU
bounds check must be done inside the lock.. duh
parent
65e9c092
Changes
1
Hide whitespace changes
Inline
Side-by-side
telnet_gui/screen.go
View file @
9f59ab99
...
...
@@ -220,11 +220,11 @@ func NewView(s *Screen, x, y, w, h int) (v *View) {
}
func
(
v
*
View
)
DrawBlockRaw
(
block
[]
byte
,
x
,
y
int
)
{
v
.
S
.
mutex
.
Lock
()
defer
v
.
S
.
mutex
.
Unlock
()
if
x
<
0
||
y
<
0
||
v
.
W
<=
x
||
v
.
H
<=
y
{
return
}
v
.
S
.
mutex
.
Lock
()
defer
v
.
S
.
mutex
.
Unlock
()
v
.
S
.
drawBlockUnlockedRaw
(
block
,
v
.
X
+
x
,
v
.
Y
+
y
)
}
...
...
@@ -233,11 +233,11 @@ func (v *View) DrawBlock(fg, bg Color, symbol byte, x, y int) {
}
func
(
v
*
View
)
DrawBlockAttr
(
fg
,
bg
Color
,
symbol
byte
,
x
,
y
int
,
underline
,
bold
Attr
)
{
v
.
S
.
mutex
.
Lock
()
defer
v
.
S
.
mutex
.
Unlock
()
if
x
<
0
||
y
<
0
||
v
.
W
<=
x
||
v
.
H
<=
y
{
return
}
v
.
S
.
mutex
.
Lock
()
defer
v
.
S
.
mutex
.
Unlock
()
v
.
S
.
drawBlockUnlocked
(
fg
,
bg
,
symbol
,
v
.
X
+
x
,
v
.
Y
+
y
,
underline
,
bold
)
}
...
...
Write
Preview
Supports
Markdown
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