MCPcopy Create free account
hub / github.com/bsauce/kernel-exploit-factory / write_file

Function write_file

CVE-2022-27666/exploit/exploit.c:236–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234 })
235
236static bool write_file(const char* file, const char* what, ...)
237{
238 char buf[1024];
239 va_list args;
240 va_start(args, what);
241 vsnprintf(buf, sizeof(buf), what, args);
242 va_end(args);
243 buf[sizeof(buf) - 1] = 0;
244 int len = strlen(buf);
245 int fd = open(file, O_WRONLY | O_CLOEXEC);
246 if (fd == -1)
247 return false;
248 if (write(fd, buf, len) != len) {
249 close(fd);
250 return false;
251 }
252 close(fd);
253 return true;
254}
255
256struct nlmsg {
257 char* pos;

Callers 2

netdevsim_addFunction · 0.70
namespace_sandbox_procFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected