Dev.to Security πŸ” Cybersecurity πŸ‘ 1 πŸ“– 1 min read

You have been zigged (series) : About system function from stdlib.h

The 12th program uses system function from stdlib.h. This function is not available in zig. Zig users are supposed to use std.process.run() and std.process.spawn() functions instead because its more safer. If you really

Cover image for You have been zigged (series) : About system function from stdlib.h
Black Tornado
Black Tornado

Posted on Jun 11

You have been zigged (series) : About system function from stdlib.h

The 12th program uses system function from stdlib.h. This function is not available in zig. Zig users are supposed to use std.process.run() and std.process.spawn() functions instead because its more safer. If you really really want to execute commands using shell injection you can pass the string "sh" before the command in argv array (code from blog 11) like .argv = &.{ "sh", "-c", "ls", "-l" }.

Thanks for reading. To be continued.

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.