[libxml2] xmllint --pretty crashed without following numeric argument
- From: Daniel Veillard <veillard src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] xmllint --pretty crashed without following numeric argument
- Date: Thu, 29 Aug 2013 08:45:30 +0000 (UTC)
commit 2205ff4b0d4a70ed986f28b27c4a2037f6f0af1f
Author: Tim Galeckas <tim galeckas com>
Date: Thu Aug 29 16:44:33 2013 +0800
xmllint --pretty crashed without following numeric argument
https://bugzilla.gnome.org/show_bug.cgi?id=674789
We need to check for NULL argument before calling atoi()
xmllint.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/xmllint.c b/xmllint.c
index 92e6b03..d69722c 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -3388,11 +3388,13 @@ main(int argc, char **argv) {
(!strcmp(argv[i], "--pretty"))) {
i++;
#ifdef LIBXML_OUTPUT_ENABLED
- format = atoi(argv[i]);
- if (format == 1) {
- noblanks++;
- xmlKeepBlanksDefault(0);
- }
+ if (argv[i] != NULL) {
+ format = atoi(argv[i]);
+ if (format == 1) {
+ noblanks++;
+ xmlKeepBlanksDefault(0);
+ }
+ }
#endif /* LIBXML_OUTPUT_ENABLED */
}
#ifdef LIBXML_READER_ENABLED
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]