Sema: validate deref operator type and value

This commit is contained in:
Veikka Tuominen
2022-06-30 17:22:16 +03:00
parent 3c73f71177
commit ae7b32eb62
20 changed files with 91 additions and 43 deletions

View File

@@ -1868,7 +1868,7 @@ pub fn getenv(key: []const u8) ?[]const u8 {
}
// Search the entire `environ` because we don't have a null terminated pointer.
var ptr = std.c.environ;
while (ptr.*) |line| : (ptr += 1) {
while (ptr[0]) |line| : (ptr += 1) {
var line_i: usize = 0;
while (line[line_i] != 0 and line[line_i] != '=') : (line_i += 1) {}
const this_key = line[0..line_i];

View File

@@ -313,7 +313,7 @@ pub fn getEnvMap(allocator: Allocator) !EnvMap {
return result;
} else if (builtin.link_libc) {
var ptr = std.c.environ;
while (ptr.*) |line| : (ptr += 1) {
while (ptr[0]) |line| : (ptr += 1) {
var line_i: usize = 0;
while (line[line_i] != 0 and line[line_i] != '=') : (line_i += 1) {}
const key = line[0..line_i];