Skip to content

Commit

Permalink
fix: use ParseInt instead of Atoi to prevent potential integer overflow
Browse files Browse the repository at this point in the history
Signed-off-by: Thorsten Hans <thorsten.hans@fermyon.com>
ThorstenHans authored and 0xE282B0 committed Jan 20, 2025
1 parent f8d3f97 commit 125d360
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/controller/shim_controller.go
Original file line number Diff line number Diff line change
@@ -463,7 +463,7 @@ func (sr *ShimReconciler) createJobManifest(shim *rcmv1.Shim, node *corev1.Node,
}
// set ttl for the installer job only if specified by the user
if ttlStr := os.Getenv("SHIM_NODE_INSTALLER_JOB_TTL"); ttlStr != "" {
if ttl, err := strconv.Atoi(ttlStr); err == nil && ttl > 0 {
if ttl, err := strconv.ParseInt(ttlStr, 10, 32); err == nil && ttl > 0 {
job.Spec.TTLSecondsAfterFinished = ptr(int32(ttl))
}
}

0 comments on commit 125d360

Please sign in to comment.