mirror of
https://github.com/tailix/libkernaux.git
synced 2024-11-13 11:04:27 -05:00
Fix error message
This commit is contained in:
parent
7ac36e8fc4
commit
10960c901d
2 changed files with 24 additions and 24 deletions
|
@ -85,7 +85,7 @@ bool kernaux_cmdline(
|
|||
}
|
||||
|
||||
if (buffer_pos >= buffer_size) {
|
||||
strcpy(error_msg, "arg too long");
|
||||
strcpy(error_msg, "buffer overflow");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ bool kernaux_cmdline(
|
|||
}
|
||||
|
||||
if (buffer_pos >= buffer_size) {
|
||||
strcpy(error_msg, "arg too long");
|
||||
strcpy(error_msg, "buffer overflow");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ bool kernaux_cmdline(
|
|||
case TOKEN:
|
||||
if (cur == '\0') {
|
||||
if (buffer_pos >= buffer_size) {
|
||||
strcpy(error_msg, "arg too long");
|
||||
strcpy(error_msg, "buffer overflow");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ bool kernaux_cmdline(
|
|||
}
|
||||
else if (cur == ' ') {
|
||||
if (buffer_pos >= buffer_size) {
|
||||
strcpy(error_msg, "arg too long");
|
||||
strcpy(error_msg, "buffer overflow");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ bool kernaux_cmdline(
|
|||
}
|
||||
else {
|
||||
if (buffer_pos >= buffer_size) {
|
||||
strcpy(error_msg, "arg too long");
|
||||
strcpy(error_msg, "buffer overflow");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ bool kernaux_cmdline(
|
|||
}
|
||||
else {
|
||||
if (buffer_pos >= buffer_size) {
|
||||
strcpy(error_msg, "arg too long");
|
||||
strcpy(error_msg, "buffer overflow");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ bool kernaux_cmdline(
|
|||
}
|
||||
else if (cur == '"') {
|
||||
if (buffer_pos >= buffer_size) {
|
||||
strcpy(error_msg, "arg too long");
|
||||
strcpy(error_msg, "buffer overflow");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ bool kernaux_cmdline(
|
|||
}
|
||||
else {
|
||||
if (buffer_pos >= buffer_size) {
|
||||
strcpy(error_msg, "arg too long");
|
||||
strcpy(error_msg, "buffer overflow");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ bool kernaux_cmdline(
|
|||
}
|
||||
else {
|
||||
if (buffer_pos >= buffer_size) {
|
||||
strcpy(error_msg, "arg too long");
|
||||
strcpy(error_msg, "buffer overflow");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,17 +105,17 @@ int main()
|
|||
test("foo bar car", 0, 4, true, "", 3, argv_foo_bar_car);
|
||||
test("foo bar car", 3, 4, true, "", 3, argv_foo_bar_car);
|
||||
|
||||
test("foo bar car", 2, 0, false, "too many args", 0, NULL);
|
||||
test("foo bar car", 0, 3, false, "arg too long", 0, NULL);
|
||||
test("foo bar car", 2, 3, false, "arg too long", 0, NULL);
|
||||
test("foo bar car", 2, 0, false, "too many args", 0, NULL);
|
||||
test("foo bar car", 0, 3, false, "buffer overflow", 0, NULL);
|
||||
test("foo bar car", 2, 3, false, "buffer overflow", 0, NULL);
|
||||
|
||||
test("\"foo\" \"bar\" \"car\"", 3, 0, true, "", 3, argv_foo_bar_car);
|
||||
test("\"foo\" \"bar\" \"car\"", 0, 4, true, "", 3, argv_foo_bar_car);
|
||||
test("\"foo\" \"bar\" \"car\"", 3, 4, true, "", 3, argv_foo_bar_car);
|
||||
|
||||
test("\"foo\" \"bar\" \"car\"", 2, 0, false, "too many args", 0, NULL);
|
||||
test("\"foo\" \"bar\" \"car\"", 0, 3, false, "arg too long", 0, NULL);
|
||||
test("\"foo\" \"bar\" \"car\"", 2, 3, false, "arg too long", 0, NULL);
|
||||
test("\"foo\" \"bar\" \"car\"", 2, 0, false, "too many args", 0, NULL);
|
||||
test("\"foo\" \"bar\" \"car\"", 0, 3, false, "buffer overflow", 0, NULL);
|
||||
test("\"foo\" \"bar\" \"car\"", 2, 3, false, "buffer overflow", 0, NULL);
|
||||
|
||||
test("\\ ", 0, 0, true, "", 1, argv_space);
|
||||
test("\"\\ \"", 0, 0, true, "", 1, argv_space);
|
||||
|
@ -201,15 +201,15 @@ int main()
|
|||
test("\\\\\\\\\\\\ \\\\\\\\\\\\ \\\\\\\\\\\\", 3, 4, true, "", 3, argv_backslashX3_X3);
|
||||
test("\\\"\\\"\\\" \\\"\\\"\\\" \\\"\\\"\\\"", 3, 4, true, "", 3, argv_quotmarkX3_X3);
|
||||
|
||||
test("\\ \\ \\ \\ \\ \\ \\ \\ \\ ", 2, 0, false, "too many args", 0, NULL);
|
||||
test("\\\\\\\\\\\\ \\\\\\\\\\\\ \\\\\\\\\\\\", 2, 0, false, "too many args", 0, NULL);
|
||||
test("\\\"\\\"\\\" \\\"\\\"\\\" \\\"\\\"\\\"", 2, 0, false, "too many args", 0, NULL);
|
||||
test("\\ \\ \\ \\ \\ \\ \\ \\ \\ ", 0, 3, false, "arg too long", 0, NULL);
|
||||
test("\\\\\\\\\\\\ \\\\\\\\\\\\ \\\\\\\\\\\\", 0, 3, false, "arg too long", 0, NULL);
|
||||
test("\\\"\\\"\\\" \\\"\\\"\\\" \\\"\\\"\\\"", 0, 3, false, "arg too long", 0, NULL);
|
||||
test("\\ \\ \\ \\ \\ \\ \\ \\ \\ ", 2, 3, false, "arg too long", 0, NULL);
|
||||
test("\\\\\\\\\\\\ \\\\\\\\\\\\ \\\\\\\\\\\\", 2, 3, false, "arg too long", 0, NULL);
|
||||
test("\\\"\\\"\\\" \\\"\\\"\\\" \\\"\\\"\\\"", 2, 3, false, "arg too long", 0, NULL);
|
||||
test("\\ \\ \\ \\ \\ \\ \\ \\ \\ ", 2, 0, false, "too many args", 0, NULL);
|
||||
test("\\\\\\\\\\\\ \\\\\\\\\\\\ \\\\\\\\\\\\", 2, 0, false, "too many args", 0, NULL);
|
||||
test("\\\"\\\"\\\" \\\"\\\"\\\" \\\"\\\"\\\"", 2, 0, false, "too many args", 0, NULL);
|
||||
test("\\ \\ \\ \\ \\ \\ \\ \\ \\ ", 0, 3, false, "buffer overflow", 0, NULL);
|
||||
test("\\\\\\\\\\\\ \\\\\\\\\\\\ \\\\\\\\\\\\", 0, 3, false, "buffer overflow", 0, NULL);
|
||||
test("\\\"\\\"\\\" \\\"\\\"\\\" \\\"\\\"\\\"", 0, 3, false, "buffer overflow", 0, NULL);
|
||||
test("\\ \\ \\ \\ \\ \\ \\ \\ \\ ", 2, 3, false, "buffer overflow", 0, NULL);
|
||||
test("\\\\\\\\\\\\ \\\\\\\\\\\\ \\\\\\\\\\\\", 2, 3, false, "buffer overflow", 0, NULL);
|
||||
test("\\\"\\\"\\\" \\\"\\\"\\\" \\\"\\\"\\\"", 2, 3, false, "buffer overflow", 0, NULL);
|
||||
|
||||
test("\\", 0, 0, false, "EOL after backslash", 0, NULL);
|
||||
test(" \\", 0, 0, false, "EOL after backslash", 0, NULL);
|
||||
|
|
Loading…
Reference in a new issue