0

Here's my code piece:

FILE *f;
char cmd[4096] = {0};

snprintf(cmd, sizeof(cmd), "echo -n \"%s\" | openssl md5 -hex 2>/dev/null | sed 's/^.* //g'", input);
if (NULL == (f = popen(cmd, "r"))) {
    perror(popen);
}

I got cpu spin in popen() and here's my callstack:

#0  0xf54d21cc in ?? () from /lib/libpthread.so.0
#1  0xf4395eb3 in fork () from /lib/libc.so.6
#2  0xf435b1d9 in _IO_proc_open () from /lib/libc.so.6
#3  0xf435b525 in popen () from /lib/libc.so.6

I have no idea how this happened. Is there any "input" that could cause this happen?

kai
  • 1,141
  • 3
  • 15
  • 25

0 Answers0