Fix off-by-one in SSH argv checking. Fix format string warning

This commit is contained in:
Daniel P. Berrange 2008-01-15 14:23:52 +00:00
parent 32d4aeb162
commit 045d32a8e8
2 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,9 @@
Mon Jan 15 09:18:53 EST 2008 Daniel P. Berrange <berrange@redhat.com>
* src/remote_internal.c: Fix off by one in checking SSH
argv for NULL. Fix format args in error message to avoid
compile warning.
2008-01-14 Jim Meyering <meyering@redhat.com> 2008-01-14 Jim Meyering <meyering@redhat.com>
Update files from gnulib. Update files from gnulib.

View File

@ -670,11 +670,12 @@ doRemoteOpen (virConnectPtr conn,
cmd_argv[j++] = strdup (sockname ? sockname : LIBVIRTD_PRIV_UNIX_SOCKET); cmd_argv[j++] = strdup (sockname ? sockname : LIBVIRTD_PRIV_UNIX_SOCKET);
cmd_argv[j++] = 0; cmd_argv[j++] = 0;
assert (j == nr_args); assert (j == nr_args);
for (j = 0; j < nr_args; j++) for (j = 0; j < (nr_args-1); j++) {
if (cmd_argv[j] == NULL) { if (cmd_argv[j] == NULL) {
error (conn, VIR_ERR_SYSTEM_ERROR, strerror (ENOMEM)); error (conn, VIR_ERR_SYSTEM_ERROR, strerror (ENOMEM));
goto failed; goto failed;
} }
}
} }
/*FALLTHROUGH*/ /*FALLTHROUGH*/
@ -3177,7 +3178,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
} }
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL,
0, 0, msg); 0, 0, "%s", msg);
goto cleanup; goto cleanup;
} }
free(iret.mechlist); free(iret.mechlist);
@ -3253,7 +3254,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
} }
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE, __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL,
0, 0, msg); 0, 0, "%s", msg);
goto cleanup; goto cleanup;
} }