Fix bug: space was not allocated for terminal '\0' in string.

Spell "JavaScript" correctly.
This commit is contained in:
norris%netscape.com 1998-09-08 18:18:52 +00:00
parent 899616933a
commit c6b299a84d
2 changed files with 5 additions and 5 deletions

View File

@ -196,10 +196,10 @@ Process(JSContext *cx, JSObject *obj, char *filename)
/* XXX non-i18nized strings... */
if (str) {
fprintf(stderr, "Uncaught javascript exception:\n%s\n",
fprintf(stderr, "Uncaught JavaScript exception:\n%s\n",
JS_GetStringBytes(str));
} else {
fprintf(stderr, "Uncaught javascript exception\n");
fprintf(stderr, "Uncaught JavaScript exception\n");
}
}
JS_DestroyScript(cx, script);

View File

@ -72,7 +72,7 @@ exn_initPrivate(JSContext *cx, JSErrorReport *report, const char *message)
newPrivate = (JSExnPrivate *)JS_malloc(cx, sizeof (JSExnPrivate));
PR_ASSERT(message);
newMessage = (char *)JS_malloc(cx, strlen(message));
newMessage = (char *)JS_malloc(cx, strlen(message)+1);
strcpy(newMessage, message);
newPrivate->message = newMessage;
@ -81,7 +81,7 @@ exn_initPrivate(JSContext *cx, JSErrorReport *report, const char *message)
if (report->filename) {
newReport->filename =
(const char *)JS_malloc(cx, strlen(report->filename));
(const char *)JS_malloc(cx, strlen(report->filename)+1);
/* Ack. Const! */
strcpy((char *)newReport->filename, report->filename);
} else {
@ -110,7 +110,7 @@ exn_initPrivate(JSContext *cx, JSErrorReport *report, const char *message)
#if 0
if (report->uclinebuf) {
size_t len = js_strlen(report->uclinebuf);
size_t len = js_strlen(report->uclinebuf)+1;
newReport->uclinebuf =
(const jschar *)JS_malloc(cx, len);
js_strncpy(newReport->uclinebuf, report->uclinebuf, len);