Fixed potential crash when empty ANSI_STRING or UNICODE_STRING is printed

svn path=/trunk/; revision=1931
This commit is contained in:
Eric Kohl 2001-05-30 14:38:14 +00:00
parent 8c8de10906
commit 2c92d6e39b
8 changed files with 20 additions and 20 deletions

View file

@ -698,7 +698,7 @@ int __vfprintf(FILE *f, const char *fmt, va_list args)
if (qualifier == 'w') {
/* print counted unicode string */
PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
if (pus == NULL) {
if ((pus == NULL) || (pus->Buffer)) {
s = "<NULL>";
while ((*s) != 0)
putc(*s++, f);
@ -709,7 +709,7 @@ int __vfprintf(FILE *f, const char *fmt, va_list args)
} else {
/* print counted ascii string */
PANSI_STRING pus = va_arg(args, PANSI_STRING);
if (pus == NULL) {
if ((pus == NULL) || (pus->Buffer)) {
s = "<NULL>";
while ((*s) != 0)
putc(*s++, f);

View file

@ -700,7 +700,7 @@ int __vfwprintf(FILE *f, const wchar_t *fmt, va_list args)
if (qualifier == L'w') {
/* print counted unicode string */
PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
if (pus == NULL) {
if ((pus == NULL) || (pus->Buffer)) {
sw = L"<NULL>";
while ((*sw) != 0)
putwc(*sw++, f);
@ -711,7 +711,7 @@ int __vfwprintf(FILE *f, const wchar_t *fmt, va_list args)
} else {
/* print counted ascii string */
PANSI_STRING pus = va_arg(args, PANSI_STRING);
if (pus == NULL) {
if ((pus == NULL) || (pus->Buffer)) {
sw = L"<NULL>";
while ((*sw) != 0)
putwc(*sw++, f);

View file

@ -698,7 +698,7 @@ int __vfprintf(FILE *f, const char *fmt, va_list args)
if (qualifier == 'w') {
/* print counted unicode string */
PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
if (pus == NULL) {
if ((pus == NULL) || (pus->Buffer)) {
s = "<NULL>";
while ((*s) != 0)
putc(*s++, f);
@ -709,7 +709,7 @@ int __vfprintf(FILE *f, const char *fmt, va_list args)
} else {
/* print counted ascii string */
PANSI_STRING pus = va_arg(args, PANSI_STRING);
if (pus == NULL) {
if ((pus == NULL) || (pus->Buffer)) {
s = "<NULL>";
while ((*s) != 0)
putc(*s++, f);

View file

@ -700,7 +700,7 @@ int __vfwprintf(FILE *f, const wchar_t *fmt, va_list args)
if (qualifier == L'w') {
/* print counted unicode string */
PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
if (pus == NULL) {
if ((pus == NULL) || (pus->Buffer)) {
sw = L"<NULL>";
while ((*sw) != 0)
putwc(*sw++, f);
@ -711,7 +711,7 @@ int __vfwprintf(FILE *f, const wchar_t *fmt, va_list args)
} else {
/* print counted ascii string */
PANSI_STRING pus = va_arg(args, PANSI_STRING);
if (pus == NULL) {
if ((pus == NULL) || (pus->Buffer)) {
sw = L"<NULL>";
while ((*sw) != 0)
putwc(*sw++, f);

View file

@ -1,4 +1,4 @@
/* $Id: sprintf.c,v 1.4 2001/02/19 15:04:51 dwelch Exp $
/* $Id: sprintf.c,v 1.5 2001/05/30 14:37:25 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -314,7 +314,7 @@ int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
if (qualifier == 'w') {
/* print counted unicode string */
PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
if (pus == NULL) {
if ((pus == NULL) || (pus->Buffer)) {
s = "<NULL>";
while ((*s) != 0)
*str++ = *s++;
@ -325,7 +325,7 @@ int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
} else {
/* print counted ascii string */
PANSI_STRING pus = va_arg(args, PANSI_STRING);
if (pus == NULL) {
if ((pus == NULL) || (pus->Buffer)) {
s = "<NULL>";
while ((*s) != 0)
*str++ = *s++;

View file

@ -1,4 +1,4 @@
/* $Id: swprintf.c,v 1.6 2001/02/19 15:04:51 dwelch Exp $
/* $Id: swprintf.c,v 1.7 2001/05/30 14:37:25 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -326,7 +326,7 @@ int _vsnwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, va_list args)
if (qualifier == 'h') {
/* print counted ascii string */
PANSI_STRING pus = va_arg(args, PANSI_STRING);
if (pus == NULL) {
if ((pus == NULL) || (pus->Buffer)) {
sw = L"<NULL>";
while ((*sw) != 0)
*str++ = *sw++;
@ -337,7 +337,7 @@ int _vsnwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, va_list args)
} else {
/* print counted unicode string */
PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
if (pus == NULL) {
if ((pus == NULL) || (pus->Buffer)) {
sw = L"<NULL>";
while ((*sw) != 0)
*str++ = *sw++;

View file

@ -1,4 +1,4 @@
/* $Id: sprintf.c,v 1.4 2001/02/19 15:04:51 dwelch Exp $
/* $Id: sprintf.c,v 1.5 2001/05/30 14:36:52 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -313,7 +313,7 @@ int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
if (qualifier == 'w') {
/* print counted unicode string */
PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
if (pus == NULL) {
if ((pus == NULL) || (pus->Buffer == NULL)) {
s = "<NULL>";
while ((*s) != 0)
*str++ = *s++;
@ -324,7 +324,7 @@ int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
} else {
/* print counted ascii string */
PANSI_STRING pus = va_arg(args, PANSI_STRING);
if (pus == NULL) {
if ((pus == NULL) || (pus->Buffer == NULL)) {
s = "<NULL>";
while ((*s) != 0)
*str++ = *s++;

View file

@ -1,4 +1,4 @@
/* $Id: swprintf.c,v 1.4 2001/02/19 15:04:51 dwelch Exp $
/* $Id: swprintf.c,v 1.5 2001/05/30 14:36:52 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -325,7 +325,7 @@ int _vsnwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, va_list args)
if (qualifier == 'h') {
/* print counted ascii string */
PANSI_STRING pus = va_arg(args, PANSI_STRING);
if (pus == NULL) {
if ((pus == NULL) || (pus->Buffer == NULL)) {
sw = L"<NULL>";
while ((*sw) != 0)
*str++ = *sw++;
@ -336,7 +336,7 @@ int _vsnwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, va_list args)
} else {
/* print counted unicode string */
PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
if (pus == NULL) {
if ((pus == NULL) || (pus->Buffer == NULL)) {
sw = L"<NULL>";
while ((*sw) != 0)
*str++ = *sw++;