}
/* Strip end of line characters. */
i = strlen(buffer);
- while (isspace(buffer[i - 1]))
+ while (i > 0 && isspace(buffer[i - 1]))
buffer[--i] = 0;
if (!strcmp(buffer, "capabilities")) {
int output_fd = -1;
char *end;
- if (argc < 3)
- die("URL missing");
+ if (argc != 3)
+ die("Expected two arguments");
input_fd = (int)strtoul(argv[2], &end, 10);