This changes the way ifconfig(8) to print lines like 'crazy "nwid',
i.e., containing double quotes inside the data being output.
At the present, such lines will be printed in the following way:

"crazy "nwid"

And this makes everything that tries to parse such lines go crazy
in their turn. I propose to force unambigious hexadecimal output
in this case.

Objections/okays?
--
WBR,
  Vadim Zhukov


Index: ifconfig.c
===================================================================
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.287
diff -u -p -r1.287 ifconfig.c
--- ifconfig.c  12 Jul 2014 19:58:17 -0000      1.287
+++ ifconfig.c  10 Aug 2014 21:11:03 -0000
@@ -1499,8 +1499,8 @@ print_string(const u_int8_t *buf, int le
 
        if (len < 2 || buf[0] != '0' || tolower(buf[1]) != 'x') {
                for (; i < len; i++) {
-                       /* Only print 7-bit ASCII keys */
-                       if (buf[i] & 0x80 || !isprint(buf[i]))
+                       /* Only print 7-bit ASCII keys, excluding double quote 
*/
+                       if (buf[i] & 0x80 || !isprint(buf[i]) || buf[i] == '"')
                                break;
                        if (isspace(buf[i]))
                                hasspc++;

Reply via email to