diff --git a/epan/dissectors/packet-cups.c b/epan/dissectors/packet-cups.c
index 6f60d9f..bcb8e37 100644
--- a/epan/dissectors/packet-cups.c
+++ b/epan/dissectors/packet-cups.c
@@ -280,7 +280,7 @@ get_quoted_string(tvbuff_t *tvb, gint offset, gint *next_offset, guint *len)
if (o != -1) {
offset++;
l = o - offset;
- s = tvb_get_ptr(tvb, offset, l);
+ s = tvb_get_ephemeral_string_enc(tvb, offset, l, ENC_ASCII);
offset = o + 1;
}
}
@@ -301,7 +301,7 @@ get_unquoted_string(tvbuff_t *tvb, gint offset, gint *next_offset, guint *len)
o = tvb_pbrk_guint8(tvb, offset, -1, " \t\r\n", NULL);
if (o != -1) {
l = o - offset;
- s = tvb_get_ptr(tvb, offset, l);
+ s = tvb_get_ephemeral_string_enc(tvb, offset, l, ENC_ASCII);
offset = o;
}