summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-10-24 23:16:30 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-23 12:15:05 -0800
commit08093c25a91c07ab8af7cece9bba738b827cfd1b (patch)
tree782fcb6921d2e432de5b9ba886b539f08c8ff596 /hw
parentacde97a39d35bfb03af2614c68176ad9afb71f53 (diff)
Convert some malloc + strncpy pairs into strndup calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/kdrive/src/kinput.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 6a1ce49e0..9c0b34fe1 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1049,12 +1049,10 @@ KdGetOptions (InputOption **options, char *string)
if (strchr(string, '='))
{
tam_key = (strchr(string, '=') - string);
- key = malloc(tam_key + 1);
+ key = strndup(string, tam_key);
if (!key)
goto out;
- strncpy(key, string, tam_key);
- key[tam_key] = '\0';
value = strdup(strchr(string, '=') + 1);
if (!value)
goto out;