about summary refs log tree commit diff stats
path: root/001help.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-10-14 21:45:24 -0700
committerKartik Agaram <vc@akkartik.com>2020-10-14 21:45:24 -0700
commit49ed062cb1fd364d6c794db4092920d54d516abc (patch)
treede43ffdddb3ff51299ffd11cbd4d1dbdfa328d8e /001help.cc
parent480fd9958abbd9b3b8443190ece755504cacdf9c (diff)
downloadmu-49ed062cb1fd364d6c794db4092920d54d516abc.tar.gz
7033
Thanks Max Bernstein for pointing out this bug:
  https://git.sr.ht/~akkartik/mu-x86_64/commit/9e2ef1c90d
Diffstat (limited to '001help.cc')
-rw-r--r--001help.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/001help.cc b/001help.cc
index 5fd13a7b..87466acd 100644
--- a/001help.cc
+++ b/001help.cc
@@ -95,8 +95,10 @@ void init_help() {
 }
 
 :(code)
-bool is_equal(char* s, const char* lit) {
-  return strncmp(s, lit, strlen(lit)) == 0;
+bool is_equal(const char* s, const char* lit) {
+  size_t len = strlen(lit);
+  if (strlen(s) != len) return false;
+  return strncmp(s, lit, len) == 0;
 }
 
 bool starts_with(const string& s, const string& pat) {