patch %s out of format strings received from phone
%s can obviously not work, as we have no access to the targets memory
space on the host PC. I guess the programmers adding those log lines
have done so in error. Let's replace %s with %p in the format string.
diff --git a/src/diag_msg.c b/src/diag_msg.c
index 0a96ce6..82c80bf 100644
--- a/src/diag_msg.c
+++ b/src/diag_msg.c
@@ -100,6 +100,12 @@
printf("MSG(%u|%u|%s:%u): ", osmo_load16le(&msg->subsys_id),
diag_ts_to_epoch(osmo_load64le(&msg->hdr.timestamp)),
file, osmo_load16le(&msg->line_nr));
+
+ /* replace all '%s' with '%p', as %s obviously doesn't work */
+ for (char *cur = fmt; cur && (cur < fmt + strlen(fmt)); cur = strstr(fmt, "%s")) {
+ cur[1] = 'p';
+ }
+
switch (num_args) {
case 0:
fputs(fmt, stdout);