~xnox/whoopsie/guard-const

« back to all changes in this revision

Viewing changes to src/identifier.c

  • Committer: Dimitri John Ledkov
  • Date: 2014-06-10 02:53:58 UTC
  • Revision ID: dimitri.ledkov@canonical.com-20140610025358-7mzhq5n3wdierrvc
Do not try to realloc string literals.

Make a failing test-case, then fix code to use strdup (safe) instead
of doing realloc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
235
235
        return;
236
236
    }
237
237
 
238
 
    size_t old_len = *result ? strlen(*result) : 0;
239
 
 
240
 
    *result = g_realloc (*result, old_len + imei_len + 1);
241
 
    strcpy (*result + old_len, imei);
242
 
 
 
238
    *result = g_strdup_printf ("%s%s", *result, imei);
243
239
    g_variant_unref(var4);
244
240
}
245
241