Skip to content

Commit 69ce108

Browse files
montgeclaude
andcommitted
Fix CodeQL security alerts
- sched.c: Fix scanf return value check (check != 1 instead of == 0) to properly handle EOF condition - ci.yml: Add explicit permissions block to restrict workflow to read-only contents access (security best practice) Fixes CodeQL alerts nimble-code#27 (incorrectly-checked-scanf) and nimble-code#30-35 (missing-workflow-permissions) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9ebd13f commit 69ce108

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
pull_request:
77
branches: [master, main]
88

9+
# Restrict permissions to minimum required
10+
permissions:
11+
contents: read
12+
913
jobs:
1014
build-linux:
1115
runs-on: ubuntu-latest

Src/sched.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ try_more: for (X_lst = run_lst, k = 1; X_lst; X_lst = X_lst->nxt)
569569
} else
570570
{ char buf[256];
571571
fflush(stdout);
572-
if (scanf("%64s", buf) == 0)
572+
if (scanf("%64s", buf) != 1)
573573
{ printf("\tno input\n");
574574
goto try_again;
575575
}

0 commit comments

Comments
 (0)