mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-13 11:15:08 +00:00
Don't access line[-1] for a zero-length "line" from fgets.
A NUL byte at beginning of input, or just after a newline would provoke an invalid buf[-1] access (possible segfault). * src/libvirt.c (virConnectAuthCallbackDefault):
This commit is contained in:
parent
5912e7c233
commit
a430f22be4
26
ChangeLog
26
ChangeLog
@ -1,3 +1,10 @@
|
|||||||
|
Mon Jan 21 15:03:04 CET 2008 Jim Meyering <meyering@redhat.com>
|
||||||
|
|
||||||
|
Don't access line[-1] for a zero-length "line" from fgets.
|
||||||
|
A NUL byte at beginning of input, or just after a newline
|
||||||
|
would provoke an invalid buf[-1] access (possible segfault).
|
||||||
|
* src/libvirt.c (virConnectAuthCallbackDefault):
|
||||||
|
|
||||||
Mon Jan 21 09:25:12 CET 2008 Daniel Veillard <veillard@redhat.com>
|
Mon Jan 21 09:25:12 CET 2008 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
* src/xml-internal.c: apply patch from Hiroyuki Kaguchi to
|
* src/xml-internal.c: apply patch from Hiroyuki Kaguchi to
|
||||||
@ -27,7 +34,24 @@ Sat Jan 19 13:32:22 EST 2008 Daniel P. Berrange <berrange@redhat.com>
|
|||||||
src/xend_internal.c: Use generic VIR_DEBUG macro for logging.
|
src/xend_internal.c: Use generic VIR_DEBUG macro for logging.
|
||||||
Enable debug when env var LIBVIRT_DEBUG=1
|
Enable debug when env var LIBVIRT_DEBUG=1
|
||||||
|
|
||||||
Tue Jan 15 16:25:57 CET Jim Meyering <meyering@redhat.com>
|
Thu Jan 17 23:12:42 CET 2008 Jim Meyering <meyering@redhat.com>
|
||||||
|
|
||||||
|
Handle PyTuple_New's malloc failure.
|
||||||
|
* python/libvir.c (libvirt_virDomainBlockStats): Handle a NULL
|
||||||
|
return from PyTuple_New.
|
||||||
|
(libvirt_virDomainInterfaceStats, libvirt_virGetLastError): Likewise.
|
||||||
|
(libvirt_virConnGetLastError): Likewise.
|
||||||
|
|
||||||
|
Factor out some duplication.
|
||||||
|
* python/libvir.c (VIR_PY_NONE): New macro, to encapsulate
|
||||||
|
a common two-statement sequence.
|
||||||
|
Replace all such 2-stmt sequences.
|
||||||
|
|
||||||
|
Avoid format string warnings.
|
||||||
|
* src/virsh.c: Add "%s" where needed.
|
||||||
|
* src/proxy_internal.c: Likewise.
|
||||||
|
|
||||||
|
Tue Jan 15 16:25:57 CET 2008 Jim Meyering <meyering@redhat.com>
|
||||||
|
|
||||||
* docs/examples/examples.xml: Regenerate, now that *.c file names
|
* docs/examples/examples.xml: Regenerate, now that *.c file names
|
||||||
are sorted.
|
are sorted.
|
||||||
|
@ -70,6 +70,7 @@ static int virConnectAuthCallbackDefault(virConnectCredentialPtr cred,
|
|||||||
for (i = 0 ; i < ncred ; i++) {
|
for (i = 0 ; i < ncred ; i++) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char *bufptr = buf;
|
char *bufptr = buf;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
if (printf("%s:", cred[i].prompt) < 0)
|
if (printf("%s:", cred[i].prompt) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -88,8 +89,9 @@ static int virConnectAuthCallbackDefault(virConnectCredentialPtr cred,
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (buf[strlen(buf)-1] == '\n')
|
len = strlen(buf);
|
||||||
buf[strlen(buf)-1] = '\0';
|
if (len != 0 && buf[len-1] == '\n')
|
||||||
|
buf[len-1] = '\0';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_CRED_PASSPHRASE:
|
case VIR_CRED_PASSPHRASE:
|
||||||
|
Loading…
Reference in New Issue
Block a user