Skip to content

Commit aa15561

Browse files
blblackalexrp
authored andcommitted
std.posix.getsockopt: set option length correctly
Fixes #24293
1 parent 31bc6d5 commit aa15561

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/std/posix.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4335,7 +4335,7 @@ pub const GetSockOptError = error{
43354335
} || UnexpectedError;
43364336

43374337
pub fn getsockopt(fd: socket_t, level: i32, optname: u32, opt: []u8) GetSockOptError!void {
4338-
var len: socklen_t = undefined;
4338+
var len: socklen_t = @intCast(opt.len);
43394339
switch (errno(system.getsockopt(fd, level, optname, opt.ptr, &len))) {
43404340
.SUCCESS => {
43414341
std.debug.assert(len == opt.len);

0 commit comments

Comments
 (0)