We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents bd5e4d2 + 530ac34 commit 1617347Copy full SHA for 1617347
1 file changed
Source/NSHost.m
@@ -217,11 +217,27 @@
217
{
218
NSMutableSet *names = nil;
219
NSString *key;
220
+ size_t len;
221
char *line = buf;
222
char *save = 0;
223
char *addr;
224
char *name;
225
226
+ /* Detect truncated lines: if the buffer is full and doesn't end
227
+ * with a newline, the line was too long. Drain the rest of it
228
+ * and skip processing entirely.
229
+ */
230
+ len = strlen(buf);
231
+ if (len == sizeof(buf) - 1 && buf[len - 1] != '\n')
232
+ {
233
+ int c;
234
+ while ((c = fgetc(fp)) != EOF && c != '\n')
235
236
+ ; /* drain remainder of overlong line */
237
+ }
238
+ continue;
239
240
+
241
// Skip comments
242
while (isspace(*line))
243
0 commit comments