systeminformation 5.33.19 → 5.33.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/network.js +5 -4
  2. package/package.json +1 -1
package/lib/network.js CHANGED
@@ -140,9 +140,10 @@ function getMacAddresses() {
140
140
  if (_linux || _freebsd || _openbsd || _netbsd) {
141
141
  if (typeof pathToIp === 'undefined') {
142
142
  try {
143
- const lines = execSync('which ip', util.execOptsLinux).toString().split('\n');
144
- if (lines.length && lines[0].indexOf(':') === -1 && lines[0].indexOf('/') === 0) {
145
- pathToIp = lines[0];
143
+ const ipPath = execSync('which ip', util.execOptsLinux).toString().split('\n')[0].trim();
144
+ // path is interpolated into a shell command - allow only safe characters
145
+ if (/^\/[A-Za-z0-9/_.+-]+$/.test(ipPath)) {
146
+ pathToIp = ipPath;
146
147
  } else {
147
148
  pathToIp = '';
148
149
  }
@@ -157,7 +158,7 @@ function getMacAddresses() {
157
158
  for (let i = 0; i < lines.length; i++) {
158
159
  if (lines[i] && lines[i][0] !== ' ') {
159
160
  if (pathToIp) {
160
- const nextline = lines[i + 1].trim().split(' ');
161
+ const nextline = (lines[i + 1] || '').trim().split(' ');
161
162
  if (nextline[0] === 'link/ether') {
162
163
  iface = lines[i].split(' ')[1];
163
164
  iface = iface.slice(0, iface.length - 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.33.19",
3
+ "version": "5.33.20",
4
4
  "description": "Advanced, lightweight system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",