1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

v/checker.v: disallow pointer arithmetic for InfixExpr outside unsafe {} (#5640)

This commit is contained in:
Nick Treleaven
2020-07-03 17:10:10 +01:00
committed by GitHub
parent a2395ff3e8
commit 0b49e4db1c
13 changed files with 221 additions and 93 deletions

View File

@ -7,7 +7,10 @@ fn (mut ws Client) read_handshake(seckey string) {
buffer_size := 1
mut buffer := malloc(max_buffer)
for bytes_read <= max_buffer {
res := ws.read_from_server(buffer + bytes_read, buffer_size)
mut res := 0
unsafe {
res = ws.read_from_server(buffer + bytes_read, buffer_size)
}
if res == 0 || res == -1 {
l.f('read_handshake: Failed to read handshake.')
}