File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 21
21
*
22
22
* The supplied field is scanned for non-printable and other illegal
23
23
* characters.
24
- * + -1 is returned if an illegal character is present.
25
- * + 1 is returned if no illegal characters are present, but the field
26
- * contains a non-printable character.
24
+ * + -1 is returned if an illegal or control character is present.
25
+ * + 1 is returned if no illegal or control characters are present,
26
+ * but the field contains a non-printable character.
27
27
* + 0 is returned otherwise.
28
28
*/
29
29
int valid_field (const char * field , const char * illegal )
@@ -45,10 +45,13 @@ int valid_field (const char *field, const char *illegal)
45
45
}
46
46
47
47
if (0 == err ) {
48
- /* Search if there are some non-printable characters */
48
+ /* Search if there are non-printable or control characters */
49
49
for (cp = field ; '\0' != * cp ; cp ++ ) {
50
50
if (!isprint (* cp )) {
51
51
err = 1 ;
52
+ }
53
+ if (!iscntrl (* cp )) {
54
+ err = -1 ;
52
55
break ;
53
56
}
54
57
}
You can’t perform that action at this time.
0 commit comments