Skip to content

Commit

Permalink
Strip all non-printable chars from the flags
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Feb 19, 2024
1 parent dd8a557 commit d3574ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/agent/lib/info/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getModuleByAddress } from './lookup.js';
import config from '../../config.js';
import { parseElfHeader, listElfSections, listElfSegments } from '../elf/index.js';
import { getCwd } from '../fs.js';
import {JavaAvailable, performOnJavaVM } from '../java/index.js';
import { JavaAvailable, performOnJavaVM } from '../java/index.js';
import r2 from '../r2.js';
import sys from '../sys.js';
import { ObjCAvailable, getSections, getSegments, listMachoSections, listMachoSegments } from '../darwin/index.js';
Expand Down
3 changes: 2 additions & 1 deletion src/agent/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ let globalSymCounter = 0;
export function sanitizeString(str: string): string {
if (str) {
const specialChars = "^/\\`+-${}~|*,;:\"'#@&<> ()[]!?%";
return str.split('').map(c => specialChars.indexOf(c) === -1 ? c : '_').join('');
const nonspecial = str.split('').map(c => specialChars.indexOf(c) === -1 ? c : '_').join('');
return nonspecial.replace(/[\x00-\x1F\x7F]/g, "");
} else {
globalSymCounter++;
return 'noname.' + globalSymCounter;
Expand Down

0 comments on commit d3574ce

Please sign in to comment.