Skip to content

Commit

Permalink
typos.{c -> cc}: new test
Browse files Browse the repository at this point in the history
  • Loading branch information
thypon committed Oct 10, 2023
1 parent 414c012 commit 0e7b986
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions assets/semgrep_rules/client/typos.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,26 @@ good1(char *path, char *dir, char *obj)
}
}

void
good2(char *path, char *dir, char *obj)
{
char *last;

// ok: raptor-typos
if (char *last = strrchr(path,'/' )) {
strcpy(obj, last + 1);
if (last == path) {
strcpy(dir, "/");
} else {
*last = '\0';
strcpy(dir, path);
*last = '/';
}
} else {
dir[0] = dir[0] = '\0';
}
}

int bad2(char *username)
{
int f;
Expand All @@ -67,8 +87,8 @@ int bad4(char *src, int len)
{
char dst[256];

// ruleid: raptor-typos
if (len > 0 && len <= sizeof(dst));
// REMOVED, false positive on Chromium: raptor-typos
if (len > 0 && len <= sizeof(dst)); ti
memcpy(dst, src, len);
}

Expand Down

0 comments on commit 0e7b986

Please sign in to comment.