Add standard checks to the assigning of a country name
Add check to ensure a country by that name does not exist. Ensure the length is not too long. Note this is a change behaviour for edit and change commands which used to silently truncate long names. Enforce that a country name can not have control characters in it. Ensure that a country name is not blank or just spaces.
This commit is contained in:
parent
17ad9fc5f2
commit
aa5861d10b
5 changed files with 44 additions and 28 deletions
|
@ -655,8 +655,10 @@ docountry(char op, int arg, char *p, struct natstr *np)
|
|||
|
||||
switch (op) {
|
||||
case 'n':
|
||||
if (!check_nat_name(p))
|
||||
return RET_SYN;
|
||||
pr("Country name changed from %s to %s\n", np->nat_cnam, p);
|
||||
strncpy(np->nat_cnam, p, sizeof(np->nat_cnam) - 1);
|
||||
strcpy(np->nat_cnam, p);
|
||||
break;
|
||||
case 'r':
|
||||
pr("Country representative changed from %s to %s\n",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue