Skip to content

Commit 815bd14

Browse files
committed
Merge pull request #3 from git-core/master
The patches I've sent early
2 parents 67394c6 + fa0ecd3 commit 815bd14

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

su.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ int main(int argc, char *argv[])
318318
}
319319
} else if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--shell")) {
320320
if (++i < argc) {
321-
strcpy(shell, argv[i]);
321+
strncpy(shell, argv[i], sizeof(shell));
322+
shell[sizeof(shell) - 1] = 0;
322323
} else {
323324
usage();
324325
}
@@ -395,6 +396,7 @@ int main(int argc, char *argv[])
395396
// Close the database, we're done with it. If it stays open,
396397
// it will cause problems
397398
sqlite3_close(db);
399+
db = NULL;
398400
LOGE("sudb - Database closed");
399401
}
400402

0 commit comments

Comments
 (0)