-5

I am using fgets() to parse a text file that contains hashed passwords (brypt).

This hash contains a few characters additional to alphanumeric, but to my knowledge no special characters in C.

My problem is that fgets() unexpectedly chokes when reading in a string that contains a double forward slash, e.g.

buf = $2b$10$//DXiVVE59p7G5k/4Klx/ezF7BI42QZKmoOD0NDvUuqxRE5bFFBLy

char buf[2048];
fgets(buf, sizeof(buf), fp); // fp => FILE *

It would only the read string until the end of the double forward slash.

Is this expected behaviour? I do not seem to recall that this should be considered special characters or some escape sequence?

chqrlie
  • 131,814
  • 10
  • 121
  • 189

0 Answers0