qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer


From: P J P
Subject: Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer
Date: Fri, 8 Jan 2016 19:29:31 +0530 (IST)

+-- On Fri, 8 Jan 2016, Wolfgang Bumiller wrote --+
| Ah yes, how could I miss that. Maybe just add a min() around the
| keyname_len computation?
| 
| - keyname_len = separator ? separator - keys : strlen(keys);
| + keyname_len = MIN(sizeof(keyname_buf), separator ? separator - keys : 
strlen(keys))

  Actually, only use for 'keyname_len' is in the subsequent if statement, 
which IIUC compares the keyname_buf for "<" key. Maybe it could say

  + if (!strncmp(keyname_buf, "<-", 2))

and remove the 'keyname_len' altogether.

--
 - P J P
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F



reply via email to

[Prev in Thread] Current Thread [Next in Thread]