... received from NTLM and Kerberos helpers.
This code uses MAX_AUTHTOKEN_LEN (~64KB) buffers to read response lines.
fgets(3) guarantees to terminate the supplied buffer, but it does not
return nil when the input line is larger than the buffer. We have
already detected such "Oversized message" cases for fgets(stdin) calls,
but not for fgets(FDNOUT) and fgets(FDKOUT) calls.
LogTime(), PROGRAM);
return 0;
}
+
+ if (!memchr(tbuff, '\n', sizeof(tbuff) - 1)) {
+ fprintf(stderr, "%s| %s: Oversized NTLM helper response\n",
+ LogTime(), PROGRAM);
+ return 0;
+ }
+
/*
* Need to translate NTLM reply to Negotiate reply:
* AF user => AF blob user
LogTime(), PROGRAM);
return 0;
}
+
+ if (!memchr(buff, '\n', sizeof(buff) - 1)) {
+ fprintf(stderr, "%s| %s: Oversized Kerberos helper response\n",
+ LogTime(), PROGRAM);
+ return 0;
+ }
}
buff[sizeof(buff)-1] = '\0'; // paranoid; already terminated correctly
fprintf(stdout,"%s",buff);