summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2023-03-04 16:26:00 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2023-03-04 16:26:00 (GMT)
commit7b3ef36925e938aa7a1aff22d3d3e521e32f243d (patch)
tree706a5f9519522d009e2e964bc04cf961a85e3210
parent80b392ba8ecdc71a1bba8455351b30e072d75549 (diff)
downloadtcl-7b3ef36925e938aa7a1aff22d3d3e521e32f243d.zip
tcl-7b3ef36925e938aa7a1aff22d3d3e521e32f243d.tar.gz
tcl-7b3ef36925e938aa7a1aff22d3d3e521e32f243d.tar.bz2
Protect zlib errors with check for null interp
-rw-r--r--generic/tclZlib.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index ce8da3c..cd3b3c5 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -449,12 +449,16 @@ GenerateHeader(
headerPtr->nativeCommentBuf, MAX_COMMENT_LEN-1, NULL, &len,
NULL);
if (result != TCL_OK) {
- if (result == TCL_CONVERT_UNKNOWN) {
- Tcl_AppendResult(interp, "Comment contains characters > 0xFF", NULL);
- } else {
- Tcl_AppendResult(interp, "Comment too large for zip", NULL);
+ if (interp) {
+ if (result == TCL_CONVERT_UNKNOWN) {
+ Tcl_AppendResult(
+ interp, "Comment contains characters > 0xFF", NULL);
+ }
+ else {
+ Tcl_AppendResult(interp, "Comment too large for zip", NULL);
+ }
}
- result = TCL_ERROR;
+ result = TCL_ERROR; /* TCL_CONVERT_* -> TCL_ERROR*/
goto error;
}
headerPtr->nativeCommentBuf[len] = '\0';
@@ -481,12 +485,17 @@ GenerateHeader(
headerPtr->nativeFilenameBuf, MAXPATHLEN-1, NULL, &len,
NULL);
if (result != TCL_OK) {
- if (result == TCL_CONVERT_UNKNOWN) {
- Tcl_AppendResult(interp, "Filename contains characters > 0xFF", NULL);
- } else {
- Tcl_AppendResult(interp, "Filename too large for zip", NULL);
+ if (interp) {
+ if (result == TCL_CONVERT_UNKNOWN) {
+ Tcl_AppendResult(
+ interp, "Filename contains characters > 0xFF", NULL);
+ }
+ else {
+ Tcl_AppendResult(
+ interp, "Filename too large for zip", NULL);
+ }
}
- result = TCL_ERROR;
+ result = TCL_ERROR; /* TCL_CONVERT_* -> TCL_ERROR*/
goto error;
}
headerPtr->nativeFilenameBuf[len] = '\0';